- An alias is a user-defined shortcut for a command or a series of commands. It allows you to substitute a longer command with a shorter, more memorable string.
- Create a temporary alias by using the alias command followed by the shortcut and the command you want it to replace.
- To create an alias for a command you simply specify an alias name and set it to the command.
- name: The name of the alias. command: The command or sequence of commands the alias represents. Basic Examples. Simple Aliases: Copy.
- The alias ci will now point to the cls command. In the 4DOS/4NT shell, the eset command provides an interactive command line to edit an existing alias
- Alias functions similarly to a shortcut command and has the same functionality as the full command that helps you use and remember commands.
- Think of the ‘alias’ command in Linux as a shortcut – a way to create your own commands that can represent long or complex commands.
- ...you need to do is type the word alias then use the name you wish to use to execute a command followed by "=" sign and quote the command you wish to alias.
- This might be helpful if used when creating an alias, but it is, of course, redundant when the alias command is used without arguments.
- Gaining proficiency with the Linux alias command can greatly improve your command-line experience and expedite your productivity.
Alias — команда, которая позволяет создавать ярлыки для существующих команд. Это облегчает запоминание и ускоряет выполнение.
Синтаксис команды alias:
alias синоним="команда". синоним — короткая команда (алиас), которая будет использоваться для запуска команды. команда — команда, которая будет запускаться при вызове синонима. Записывается в двойных или одинарных кавычках.
Примеры создания псевдонимов:
Вывод списка файлов: alias ll="ls -la". То есть, вместо выполнения ls -la теперь достаточно выполнить команду ll.
Подключение по ssh к определённому серверу: alias serv="ssh -p 1234 pingvinus@192.168.0.123".
По умолчанию псевдонимы сохраняются только в текущем сеансе. Чтобы сохранить их на постоянной основе, нужно прописать выполнение команд alias в файл .bashrc.
Удалить созданный псевдоним можно с помощью команды unalias. Удаление происходит только в текущей сессии терминала.