如何在Linux中创建别名? [英] How to Create an alias in Linux?

查看:124
本文介绍了如何在Linux中创建别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想为srm创建一个别名(安全删除),这样每次使用srm时,都会运行一个交互式rm命令,例如rm –i。需要对必要的配置文件进行此更改,以便每次用户登录时都设置别名。还要显示您的别名有效。

Let's say I want to create an alias for srm (safe remove), such that everytime srm is used, an interactive rm command runs, e.g. rm –i. This change needs to be made to the necessary configuration files such that the alias is set every time any user logs in. Also show that your alias works.

我该怎么办

推荐答案

编辑您的〜/ .bashrc ,并添加底部的以下一行:

Edit your ~/.bashrc, adding the following line to the bottom:

alias srm="rm -i"

这篇关于如何在Linux中创建别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆