当前位置:网站首页>Questions about Mac terminal custom commands and Mysql command
Questions about Mac terminal custom commands and Mysql command
2022-08-08 20:32:00 【Do not forget the original intention z】
Mac Terminal Custom Commands
When entering the mac terminal, we often encounter some commands that are very complicated, and each time we need to enter more commands to achieve the effect, so there is a custom command function in the mac computer
Enter the mac terminalEnter:
vim ~/.bashrc After entering the interface, we can set custom commands.
First, you can press i to enter the editing mode. The custom command has a standard format which is
alias self-defined command = "input those commands before replacing"
For example, the way to enter the mysql database is rather cumbersome.Need /urs/loacl/mysql/bin/mysql -uroot -p to enter the database, so we can modify it to
alias gomysql = "urs/loacl/mysql/bin/mysql" After that we have to press esc to exit the editing, and thenPress: colon and wq to complete the editing and exit: wq
After exiting, use the command source ~/.bashrc to import the command just now, so that we can enter in the terminal:
gomysql -u root -p and then enter youYou can just get the password, isn't it very convenient?
About the permanent effect of custom commands on Mac terminal
For Mac custom commands to take effect, you must enter the terminal and enter the command: source ~/.bashrc to successfully introduce custom commands. Is there a way to make it permanent without entering the source command??The answer is yes.One file we are going to introduce is the bash.profile file that must be executed by the Mac to start the terminal.So we have to start editing it, just write the source command into this file, see the code for details
The terminal input: vim ~/.bash.profile to enter, the problem to pay attention to here, Mac will let you choose how to open this file
Select E to edit the file, if the default is read-only mode, you cannot write commands to this file, so pay special attention to this.
Enter the file and press i to edit, enter source ~/.bashrc and press esc to exit editing, then press :wq to complete editing and exit, just like this, you will find that after closing the terminal and restarting, you can use it without entering the source command.gomysql -uroot -p has entered the database
If this helps you a little bit, please give me a like, thank you!
边栏推荐
猜你喜欢

差点被ECCV错过的论文:视频理解新框架,仅用微调的「成本」,达到预训练的「全能」...

Float.parseFloat()的作用

【无标题】

音视频技术开发周刊 | 257

劳务派遣业务流程图

How can recommender systems be trusted?A review of the latest "Trusted Recommender System" from Rutgers University, a 43-page pdf explaining the composition and technology of trusted RS

DCT变换

NAACL2022 NER SOTA - RICON study notes

Linux下使用kill杀不死Mysql进程一直杀不死的问题解决方案

随手记:laravel、updateOrCreate 和 updateOrInsert 的区别
随机推荐
Canvans:绘制饼图和玫瑰饼图
DCT变换
IJCAI 2022 | Can Graph Neural Networks Detect Anomalies?
通达信炒股软件正规吗?安全吗?
基于opencv的图片人像移除
【无标题】
一文教你普罗米修斯Prometheus的基础应用
1100 三角形面积
方舟建筑代码指令大全
PHP传递任意数量的函数参数
如何用WebSocket打造Web端IM即时通讯聊天
VSCode 必知必会的 20 个快捷键
Kotlin反射
推荐系统如何可信?罗格斯大学最新《可信推荐系统》综述,43页pdf阐述可信RS组成与技术
MySQL8 免安装版安装
源码分析Canal专栏
The WPF main form calls User32's SetWindowPos to set the form to the top, which will cause the problem of grabbing the focus with other forms
网络工程师怎么系统性学习?这份网工资料包帮你解决
头脑风暴:打家劫舍2
买股票安全吗 资金能取出来吗
