Questions tagged [alias]

In computing, an alias is an alternate name for an object, such as a variable, file or device.

In computing, an alias is an alternate name for an object, such as a variable, file or device. With the DNS system, an alias can be used to assign multiple hostnames to a computer, on Macintosh computers, files can be aliased to allow referencing the same file by different names, and in computer programming, aliasing is a situation where a location in memory is access by different symbolic names, to give a few examples.

359 questions
168
votes
4 answers

How to use spaces in a bash alias name?

I am trying to create an aliases in bash. What I want to do is map ls -la to ls -la | more In my .bashrc file this is what I attempted: alias 'ls -la'='ls -la | more' However it does not work because (I assume) it has spaces in the alias name. Is…
121
votes
5 answers

how to expand aliases inline in bash?

Is there a way to expand aliases inline in bash? $bash>alias ll='ls -l ' $bash>ll $bash>ls -l
asdfg
  • 2,936
62
votes
4 answers

How to remove zsh alias?

I have an alias which is predefined by an oh-my-zsh plugin. -> % alias gcm gcm='git checkout master' I'd like to remove it, i.e. I'd like alias | pcregrep "\bgcm\b" return 1. I've tried with alias gcm='' but after that the alias is still existent.…
54
votes
5 answers

Create permanent DOSKEY in Windows cmd

I think the title is pretty self explanatory. The question is how can I create an alias in a Windows cmd that will also work after I close and then reopen it. For example I would like an alias called ip to call the command ipconfig or an alias ls…
nick zoum
  • 613
  • 1
  • 8
  • 12
42
votes
1 answer

How can I pass an alias to sudo?

I have tried putting my aliases in ~/.bash_profile, ~/.bashrc, /etc/profile, and /etc/bashrc. I am still unable to execute the following: alias zf2="php public/index.php" and then execute: sudo zf2 orm:info The issue seems to be that I am unable…
41
votes
2 answers

How to alias a hostname on Mac OSX

In a nutshell, I would like to be able to open a browser and open local.example.com but it actually loads http://localhost/path/to/example.com/ I am using Mac OSX 10.5, and not afraid to get my hands dirty with the terminal :) I use Apache as my…
Austin Hyde
  • 1,134
37
votes
5 answers

Aliases in subshell / child process

I set up aliases in /etc/profile.d/alias.sh for each login shell. But if I run script.sh, I can't use that alias. How can I set alias even for subshells or child processes ? /etc/profile.d/alias.sh alias rmvr='rm -rv'; alias cprv='cp -rv'; alias…
lisak
  • 505
35
votes
6 answers

Add a static IP alias to a DHCP interface on Windows 8 (and above)

I have a Windows 8 machine that has only a single Ethernet port. It needs to use DHCP and also needs a static IP. Each IP is in a different subnet, and each serves a different, incompatible purpose. This machine must use DHCP because the site…
Warren Young
  • 3,835
31
votes
5 answers

How do I alias python3 on Windows?

I want to alias python3 to python on windows. I have already removed the alias for the microsoft store as described in this answer. However python3 is still not a known alias. How to I fix this?
28
votes
1 answer

Can I "export" an alias to the SHELL that invoked a script?

I'm trying to write a utility script that defines certain aliases. My SHELL is tcsh (can't change that). I tried the following #!/bin/tcsh alias log 'less ~/logs/log.`date '+%Y%m%d'`'' Then I run it like this: ./myscript log The output I get…
RonK
  • 1,540
24
votes
10 answers

Why are alias names defined in .bashrc file are not working as expected?

I have give alias names in .bashrc file like below. But the alias names are not working. why? alias c='clear' alias l='ls -lt' alias h='history' alias d='ls -lt |grep "^d"' export ORACLE_HOME=/ora11gr2/app/oracle/product/11.2.0/db2 export…
Venkatesh
  • 341
23
votes
1 answer

Bash is slow to start because of this line in .bashrc. What could cause this?

My .bashrc file contains a line to this effect: alias prog="/path/to/script.sh $(find $(pwd) -name prog)" When I comment out this line, Bash starts almost instantly when I open a new terminal. With this line, there is a 4-5 second delay before my…
BBales
  • 333
  • 1
  • 2
  • 5
21
votes
11 answers

Command aliases in Command Prompt?

How can I make command aliases in Windows' Command Prompt like I would with bash? I found out about doskey in a forum thread, so I can do something like: doskey ls=dir /b ...and now the command ls acts a little more like ls on Unix. (I type ls so…
20
votes
2 answers

Bash alias with piping

I'm not exactly sure what I'm doing wrong with this one. I'm trying to run the command alias localip='ip -4 -o addr show eth0 | egrep -o '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}' | head -n 1' If I run the command ip -4 -o addr show eth0 | egrep -o…
n8felton
  • 483
18
votes
1 answer

overriding user defined functions with the same name as system commands

This function exists in one of my users' ~/.bashrc: function rm() { ls $* echo "rm?" read ans if [ "$ans" == 'y' ]; then /bin/rm $* fi } In my ksh script that users are required to run, I have…
acm
  • 283
1
2 3
23 24