Bash shell environment variable in Linux

alias

Aliases are shortcuts to commands. It’s useful to create shortcuts for long commands that need to be executed frequently, but need to be entered for a long time. The syntax is:

alias ppp='ping www.baidu.com'

They are not always used to shorten long commands. It’s important that you use them for tasks you often perform. Possible examples:

alias update='yum update'

In this way, you can just use update to complete the command operation of Yum update.

The problem with setting aliases in a terminal is that once the terminal session is closed, the aliases are lost. To set them up permanently, use the resource file.

resource file

Resource files (RC files) are configuration files that are loaded at the beginning of a session or process (when each user opens a new terminal window or starts a new program such as VIM). For Zsh, the resource file is. Zshrc, for bash, it is. Bashrc.

To make aliases permanent, you can put them in a resource file. You can edit the resource file using the text editor of your choice. VIM is used here:

vim $HOME/.zshrc

Or for bash:

vim $HOME/.bashrc

In this way, after we create a new terminal, we can still use the commands we created to complete some longer command operations

让您学习到的每一节课都有所收获

Linux should learn this is a high-quality self-study course of Linux technology jointly written by senior operation and maintenance expert Liu Tan and many red hat Architects (rhca) in China based on the latest rhel7 system, which is extremely suitable for Linux technology introductory course or lecture auxiliary textbook. Won the IT book sales champion of double 11 and double 12 shopping carnival, and the fastest-growing technical books in 2017 and 2018, you can buy them after JD, Dangdang, Amazon and tmall search the titles, or add teacher Liu Trent’s wechat communication and learning (press and hold the figure below for 3 seconds to scan automatically)~


Teacher Liu Trent QQ: 5604922

☑ & nbsp; Linux technology exchange group: 2265381 (new group, hot group…)

Official website: www.linuxprobe.com

☑ online learning of books (better effect of online reading on computer):

第0章 咱们先来谈谈学习方法和红帽系统。

This is how to learn Linux is a technical book written based on the latest Linux system for zero base readers. Starting from the basic knowledge of Linux, then gradually improve the difficulty of content, explain the working principle and configuration mode of various services in Linux system in detail to match the requirements of real production environment for operation and maintenance personnel, and highlight the practicality of content. If you want to learn Linux system, you can click the “read the original” button to learn about this book. At the same time, this book is also suitable for professional operation and maintenance personnel to read, as a very valuable reference tool book!

Leave a Reply

Your email address will not be published. Required fields are marked *