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:
-
To install any utility/application:
alias install="sudo yum install -y"
Here,
sudo
and-y
are optional as per user’s preferences: -
To update the system:
alias update="sudo yum update -y"
-
To upgrade the system:
alias upgrade="sudo yum upgrade -y"
-
To change to the root user:
alias root="sudo su -"
-
To change to "user," where "user" is set as your username:
alias user="su user"
-
To display the list of all available ports, their status, and IP:
alias myip="ip -br -c a"
-
To
ssh
to the servermyserver
:alias myserver="ssh user@my_server_ip”
-
To list all processes in the system:
alias process="ps -aux"
-
To check the status of any system service:
alias sstatus="sudo systemctl status"
-
To restart any system service:
alias srestart="sudo systemctl restart"
-
To kill any process by its name:
alias kill="sudo pkill"
-
To display the total used and free memory of the system:
alias mem="free -h"
-
To display the CPU architecture, number of CPUs, threads, etc. of the system:
alias cpu="lscpu"
-
To display the total disk size of the system:
alias disk="df -h"
-
To display the current system Linux distro (for CentOS, Fedora, and Red Hat):
alias os="cat /etc/redhat-release"
29 Comments