Questions tagged [alias]

An alias is essentially nothing more than a keyboard shortcut, an abbreviation, a means of avoiding typing a long command sequence. This can save a great deal of typing at the command-line and avoid having to remember complex combinations of commands and options.

Filter by
Sorted by
Tagged with
2
votes
1answer
41 views

How to make `python` an alias of `python3` systemwide on Debian

The latest updates of my Debian testing system removed Python version 2, and I only have Python 3 installed, with python3. There is no longer any command named python. This causes several scripts to ...
1
vote
1answer
27 views

How can I make this git alias with quotes work?

I want to make a git diff alias that only shows the changed lines (coloured). [alias] mdiff = diff --color | grep --color=never $'^\e\[3[12]m' This doesn't work, as apparently pipes cannot be ...
1
vote
2answers
38 views

Aliasing grep in find's -exec option

I have these aliases in my ~/.bashrc alias grep='grep --color=auto -H' alias fgrep='fgrep --color=auto -H' alias egrep='egrep --color=auto -H' but they have no effect when I run find ... -exec grep .....
0
votes
1answer
21 views

Scaping single quota in zsh alias

I like create any alias for docker commandas, and I need any alias use single quotes. I see post Escaping quotes in zsh alias but not work for me. Tried in .zshrc function dinfoip() { docker ...
1
vote
1answer
30 views

xdg-open autocomplete not working when calling it with alias

I've set an alias to xdg-open adding alias op="xdg-open" to my ~/.bashrc file. The command op file.pdf works, but I'm not able to autocomplete when typing, for example, op fi and hitting TAB....
0
votes
1answer
25 views

Linux - User Display name alias in shell prompt

Is it possible to alias the user display name in the shell prompt? For example: When I ssh with john123@192.168.1.2, it displays as John123 [John123@myhost ~]# Can I change it to a alias csgeek ...
0
votes
0answers
7 views

How can I enforce HTTP basic authentication on an Apache directory that is an alias?

I'm using Ubuntu 18.04 with Apache 2.4. I have created this htpasswd file ... $ ls -al /etc/apache2/.htpasswd -rwxr-xr-x 1 www-data root 49 Aug 20 20:57 /etc/apache2/.htpasswd I have this in my /etc/...
0
votes
1answer
18 views

bash function to replace every occurence of text in directory and subdirectories

I found (on Google) this perfectly working line to replace every occurences in all files in my directory and subdirectories: grep -lr previoustext | xargs sed -i 's/previoustext/newtext/g' It works ...
2
votes
2answers
44 views

Where are default aliases defined

I've got a fresh install of CentOS 8 (minimal ISO). I notice that, despite none being listed in either .bashrc or .bash_profile, a bunch of aliases are defined by default in bash. For example, alias ...
1
vote
1answer
40 views

When should you make a symbolic link instead of making an alias?

It's possible that making a symbolic link is not at all comparable to making an alias. But from what I understand about symbolic links so far, they do the same thing as setting an alias: they define a ...
1
vote
1answer
15 views

Nested settings in ssh config for domains and aliased subdomains

How can I have rules for a whole domain and also create aliases with rules for each of the subdomains without duplicating all the ruleset? In other words, why is it that in the following example ...
0
votes
1answer
35 views

How do I source a new .bashrc in an alias that switches my shell?

I have an alias I use to run sudo -s called ssu. I want it to also source my root session from the .profile in my home directory. Other answers seem to say that this is the solution: alias ssu='sudo -...
0
votes
2answers
54 views

Why are aliases skipped if escaped?

A common way to skip aliases is to add a backslash before the aliased command. For example, $ alias ls='ls -l' $ ls file -rw-r--r-- 1 user user 70 Jul 30 14:37 file $ \ls file file My research has ...
1
vote
2answers
31 views

Running a script when a particular command is run

I want to run "./dothis.sh" if someone executes "cat abc.txt" Is there some way to do this without using alias? I want to use this for strengthening security of some specific files ...
2
votes
2answers
64 views

Execute zsh alias when name contains a hyphen

A stock-standard zsh behaves as follows with an alias with a - in it, eg: a-a: % zsh -f svelte% alias a-a=date svelte% a-a Sun 19 Jul 2020 17:20:05 +07 My configuration has it behave as follows: % ...
0
votes
1answer
35 views

Can we make aliases for the commands with parameters

I want to make alias for: rm -rf * => #rm -rf * rm * => #rm * When I type rm -rf *, I want it to be commented out and not take action. [Q] General question is can we make generate aliases for ...
2
votes
1answer
50 views

Unsure if alias to combine apt-get update and apt-get upgrade is working correctly

Here are the aliases in question: alias update='sudo apt-get update' alias upgrade='sudo apt-get upgrade' alias upgrate='sudo apt-get update && sudo apt-get upgrade' Here's the output when I ...
0
votes
1answer
24 views

How to find where ksh setup aliases?

Where ksh can load aliases from? Checked /etc/profile, ~/.profile - nothing There is no ~/.kshrc. Tried: $ grep -r 'alias BADALIAS' /etc - also nothing
1
vote
1answer
37 views

Which binary would be run when we have multiple installations?

I wanted to set gsettings as /usr/bin/gsettings so I created an alias. But I am not sure if that works: $ type gsettings gsettings is aliased to `/usr/bin/gsettings' gsettings is /home/linuxbrew/....
1
vote
4answers
91 views

bash alias to create folder and move file

I am trying to create a bash alias to do the following: create a folder (with the current date as the folder name) move (or copy, either is fine with me) a file from the current folder into the new ...
0
votes
1answer
28 views

Idiomatic setting of nicknames/aliases?

On Unix systems, you have your username, say "johnsmith", and your full name, "John Smith". That's it. Now, suppose I want to use a nickname or two - something which isn't my ...
0
votes
2answers
35 views

Calling alias with other alias + parameters

i was trying to summerise grep while being able to give another command with parameters but I cannot figure out how to make it work What I am doing is this alias pac='sudo pacman' grp(){ $1 | ...
0
votes
0answers
8 views

Access myqsl client “natively” in a container from the host

I'm looking into adding MySQL monitoring to the zabbix agent and it needs mysql-client for that purpose. I'd like an approach where it accesses the client in the mysql container as if it where ...
0
votes
0answers
21 views

How to alias `kj` to `kill -9 %?`(kill job)

I want use kj 1 for kill -9 %1 I try: alias kj='kill -9 %' but I can't use either kj1 or kj 1. It's there any way to do this?
0
votes
1answer
24 views

Can't create an alias in tcsh shell when trying to sed some string with .*

I'm trying to create this alias in tcsh shell: alias repeat 'zgrep -i __NCELAB_SNAPSHO \!* | grep -v make | grep -v Flags | sed 's#CODE_COVERAGE_TYPES.*TEST_DONE=1##g'' And getting an error: alias:...
3
votes
1answer
87 views

Bash expansion behavior

I was playing around with the readline functions shell-expand-line and alias-expand-line. From the documentation: shell-expand-line Expand the line as the shell does. This performs alias and ...
1
vote
0answers
15 views

Cannot ping virtual ip from another server

I am a new member of this community and I am new to linux systems so I apologize in advance if I say something wrong. I have created a new virtual ip: ifconfig eth1:1 192.168.0.22 I can ping eth1 ...
1
vote
1answer
22 views

alias inside a script returns command not found

Using bash in a Debian system. bash --version GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &...
0
votes
1answer
36 views

Why should I provide two different paths when creating alias?

When I issue alias --help I get this output: alias: usage: alias [-p] [name[=value] ... ] As I understand, all you need to do is to type an alias and provide the actual path to the script file, like ...
1
vote
1answer
48 views

How to create an alias that launches zathura with tabbed

So tabbed outputs it's xid when you run it. How could I put this into an alias dynamically? I'm looking to do something like: alias zathura = tabbed -c zathura -e ${tabbed Xid goes here} & disown
0
votes
1answer
29 views

Attempting to add any alias to .bashrc file is always failing

My attempts to add any alias to .bashrc file is always failing. It comes as not found. Let me explain what I tried. I opened the .bashrc using the subl and then at last added the words alias rm = "...
0
votes
1answer
31 views

Why does 'echo “alias g=/home/user/examplescript” >> ~/.bash_aliases' produce this error: “no authorisation”?

When I try this code in Raspbian Buster terminal: echo "alias g=/home/user/examplescript" >> ~/.bash_aliases I get the error Authorisation Error. Following code works without problem: echo "...
0
votes
2answers
110 views

How can I define and use `alias` within `bash -c` with a one-line command?

I am trying to define and use alias within bash -c with a one-line command. The command: bash -c "eval $'df'" works fine, but: bash -c "eval $'alias df5=df\ndf5 -h'" doesn't. Why, and how can I ...
0
votes
2answers
97 views

How can I write an `eval` command containing a new line into one line?

Since I need to set and use alias in the same line in bash, I would like to use Hauke Laging's workaround: eval 'alias df5=df df5 -h' (I took df and df5 for the sake of the example. I am aware that ...
0
votes
0answers
17 views

Alias or Function for a Command [duplicate]

Sometimes (or may be all the time) an Alias and Function for a command works the same way. For example, following Alias and Function of Ping Command: alias Pingoogle='ping -c 3 google.com && ...
0
votes
2answers
37 views

SSH and aliasing

Background I'm a php developer who has started a new job. The company has numerous docker instances and the ability to spin multiple versions of this up, for example: to check a particular git branch ...
0
votes
1answer
17 views

Change the actual terminal command for executing an application (not just an alias)

I have a directory on my machine, ~/Code. I have an alias, code, that takes me to that directory. I have just installed VS Code, which uses the command code to open. I would love to keep my old alias ...
1
vote
1answer
22 views

My multiple variables in a function do not get expressed as aliases. I think my syntax is faulty

In bashrc, I have this alarm function which can take 3 variables: a () { local $1="${1:-3600}" local $2="${2:-paa}" local $3="${3:-alarm}" sleep "$1" && $2 && $3 } alias ...
0
votes
2answers
118 views

Expand (certain) aliases from within sudo bash function

There are two things I want: 1) I want that if I keep using sudo often that it never asks me for my password by updating my cached credentials every time I type sudo, 2) That I can use (certain) ...
0
votes
0answers
40 views

How do I use spaces in my command to cd to a directory and its sub directories using aliases?

Suppose I am interested in this directory: /home/username/../../../../.....dummy1 And dummy1 has these subfolders: sub_dummy1 sub_dummy2 that in turn can consist of various directories and so on. ...
0
votes
1answer
45 views

Issue creating alias with multiple arguments

Can you please tell me what I'm doing wrong? I open ~/.bashrc and I have added some aliases, like alias c=clear or alias h=history. These aliases are working. Problem is here: alias ls=ls -lhF --...
0
votes
1answer
47 views

After debian upgrade, npm is not working

I upgraded from Debian 9 to 10, and Emacs from 25 to 26.1. Then, npm was NOT working and missing but node was there. Then, re-installed npm using: $ sudo apt-get install npm npm succesfully ...
1
vote
1answer
44 views

Is it safe to alias mf command?

I routinely type mf instead of mv, and it doesn’t like to quit easily. I understand that mf is a metafont command, whatever that is. Is it safe to alias mf='mv' so I don’t have to worry about it? ...
-1
votes
1answer
33 views

Does mv use an alias by default? [closed]

In the context of shell, much as cp, rm use an alias that prompts to overwrite, does rm use an alias also? This is usually bypassed by using \cp and \rm for example. Does the same also apply to mv?
1
vote
1answer
56 views

Aliases don't work in interactive zsh

I have a curious problem where my aliases are listed when I type alias, but they are not executable. Here, I try to alias d to date: % which alias alias: shell built-in command % alias d=/usr/bin/...
0
votes
1answer
80 views

Why do some aliases work in xterm while others don't?

I'm transitioning to a new development environment for work, and I'm new to the xterm terminal and the CentOS operating system. I'm trying to set up aliases in my .bashrc: # .bashrc alias c='clear' ...
0
votes
1answer
44 views

How to set environment variables automatically?

So I do research in machine learning and use a remote GPU server to do the stuff. What I usually do when I come to work is access the server with an SSH client and run my alias hi command which is: ...
0
votes
2answers
41 views

Executing alias string command

I wrote a simple script to go through my development project directory and add an alias shortcut for each one: shopt -s dotglob #Use shopt -u dotglob to exclude hidden directories find ~/development/*...
0
votes
0answers
29 views

Apache vhost_alias - how to set user per virtualhost?

For context: I'm using a Debian or Ubuntu server with Apache 2.4, PHP 7.2 and a number of other things, to set up a development and testing environment for devs and technicians to use at work. I've ...
0
votes
3answers
96 views

Does Bash and Zsh have a mode to echo what the alias expands to upon pressing Enter?

For example, if I have a alias dbmigrate='rails db:migrate' is there a mode or simple way to configure in Bash and Zsh so that when I type in the shell: $ dbmigrate # press Enter it will echo ...

1
2 3 4 5
15