Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use command line aliases in Linux

Shulou Source: shulou.com Published: 2022-06-01 05:28:47 10月02日 Update

This article mainly shows you "how to use command line aliases in Linux". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to use command line aliases in Linux".

The Linux command line alias is perfect for helping you improve your productivity. By default, the Linux distribution you install contains some aliases.

The following is an example of a command line alias in Fedora 27:

The command alias displays a list of existing aliases. Setting an alias is actually very simple:

Alias new_name= "command"

Here are 15 command line aliases to save you time:

1. Install any utilities / applications:

Alias install= "sudo yum install-y"

According to the user's preference, sudo and-y are optional:

two。 Update the system:

Alias update= "sudo yum update-y"

3. Upgrade the system:

Alias upgrade= "sudo yum upgrade-y"

4. Change to root user:

Alias root= "sudo su -"

5. Change to "user", where "user" is set to your user name:

Alias user= "su user"

6. Displays a list of all available ports, their status and IP:

Alias myip= "ip-br-c a"

7. Ssh to server myserver:

Alias myserver= "ssh user@my_server_ip"

8. List all processes in the system:

Alias process= "ps-aux"

9. Check the status of any system services:

Alias sstatus= "sudo systemctl status"

10. Restart any system services:

Alias srestart= "sudo systemctl restart"

11. Kill any process by name:

Alias kill= "sudo pkill"

twelve。 Displays the total usage and available memory of the system:

Alias mem= "free-h"

13. Displays the CPU architecture of the system, the number of CPU, the number of threads, etc.

Alias cpu= "lscpu"

14. Displays the total disk size of the system:

Alias disk= "df-h"

15. Display the current system Linux release (for CentOS,Fedora and Red Hat):

Alias os= "cat / etc/redhat-release"

The above is all the content of the article "how to use command line aliases in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Aliases system commands content display system user article help service status program process release learning utility system preference memory name size Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB macOS Shulou Tech Info Microsoft Xiaomi