TranslateProject/sources/talk/20180828 15 command-line aliases to save you time.md

2.8 KiB
Raw Blame History

15 command-line aliases to save you time

Linux command-line aliases are great for helping you work more efficiently. Better still, some are included by default in your installed Linux distro.

This is an example of a command-line alias in Fedora 27:

The command alias shows the list of existing aliases. Setting an alias is as simple as typing:

alias new_name="command"

Here are 15 command-line aliases that will save you time:

  1. To install any utility/application:

alias install="sudo yum install -y"

Here, sudo and -y are optional as per users preferences:

install alias.png

  1. To update the system:

alias update="sudo yum update -y"

  1. To upgrade the system:

alias upgrade="sudo yum upgrade -y"

  1. To change to the root user:

alias root="sudo su -"

  1. To change to "user," where "user" is set as your username:

alias user="su user"

  1. To display the list of all available ports, their status, and IP:

alias myip="ip -br -c a"

  1. To ssh to the server myserver:

alias myserver="ssh user@my_server_ip”

  1. To list all processes in the system:

alias process="ps -aux"

  1. To check the status of any system service:

alias sstatus="sudo systemctl status"

  1. To restart any system service:

alias srestart="sudo systemctl restart"

  1. To kill any process by its name:

alias kill="sudo pkill"

kill process alias.png

  1. To display the total used and free memory of the system:

alias mem="free -h"

  1. To display the CPU architecture, number of CPUs, threads, etc. of the system:

alias cpu="lscpu"

  1. To display the total disk size of the system:

alias disk="df -h"

  1. To display the current system Linux distro (for CentOS, Fedora, and Red Hat):

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

system_details alias.png


via: https://opensource.com/article/18/8/time-saving-command-line-aliases

作者:Aarchit Modi 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出