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 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:
Or for bash:
In this way, after we create a new terminal, we can still use the commands we created to complete some longer command operations
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!