The alias built-in in shells, used to define shortcuts for frequently used commands.

learn more… | top users | synonyms

2
votes
2answers
27 views

Clear or disable aliases in zsh

I installed oh-my-zsh to make terminal use a bit easier. One thing that bugs me though is the prolific aliases added by it, like "ga", "gap", "gcmsg", "_", which are harder to remember than the ...
4
votes
1answer
78 views

How can I create an alias that passes additional arguments?

I have an executable that I use often: /dir1/dir2/dir3/dir4/executable argv[1] argv[2] argv[3] I know that I can set an alias for the executable: alias myexecutable = ...
4
votes
2answers
167 views

How to escape single quotes correctly creating an alias

I've been given this one-liner to know how much memory my processes consume. $ ps -u $USER -o pid,rss,command | \ awk '{print $0}{sum+=$2} END {print "Total", sum/1024, "MB"}' Now I'd like to ...
1
vote
2answers
33 views

In zsh how to set an alias for `less` to get stderr output?

I find that there is a "global alias" for zsh. so when I set alias -g L='| less' command L will be replaced with command | less. But it seems that it cannot work with stderr output when I set ...
4
votes
3answers
283 views

source my ~/.bash_aliases from a script not in ~/

I want to update my aliases from a script. I have some new aliases in ~/updateFiles/newAliases: alias ga='git add -A' I also have this update script ~/updateFiles/updater: #!/bin/bash cp ...
6
votes
6answers
459 views

why strace ignores my alias for rm?

I have an alias set for my rm command. If I run alias command, this is what I get as output. alias rm='rm -i' Now, when I run the rm command it works fine as expected. rm ramesh rm: remove ...
3
votes
2answers
50 views

Creating an alias to Change Directory and have that directory be the current working directory in new terminal tabs

I'm trying to create a convenience alias that will change directories and then start a node server in that directory. I have it working for the most part, there's just one little issue that I can't ...
0
votes
2answers
54 views

how to create Permanent alias from script

Please advice how to do the following magic ( I have linux red-hat machine – 5.4 ) I created the script in the following path: /usr/cti/my_scripts/MAGIC.bash I want to run this script ...
2
votes
1answer
69 views

Match empty line in an alias .bashrc

I would like to bind my empty line in my bash to a specific command (for example pwd, ls, ...), like so : $<enter> $/home/ I tried // ~/.bashrc alias ="pwd" But obviously this was ...
3
votes
1answer
25 views

Create alias that can interact with arguments [duplicate]

My ultimate goal is to simplify routine task of compilation and run. Now I've following commands 1. g++ foo.cpp -o foo --std=c++11 2. chmod foo +x #this may be overkill 3. ./foo So, my question ...
3
votes
3answers
97 views

Automatically put an alias into ~/.bashrc or ~/.zshrc [duplicate]

Is there a command line util/script that automatically saves aliases? E.g. save-alias my-ip="curl ipecho.net/plain" and that will define an alias, then add/update it in ~/.bashrc or ~/.zshrc I was ...
0
votes
1answer
54 views

Alias for finding a file not working in bash

The following alias for finding a file works in tcsh but not in bash. alias ff "find . -name '*\!{*}*' -ls" When I put the above line in .bashrc and then source it I get : bash-3.2$ source ...
1
vote
2answers
92 views

aliasing a slightly complex script on Linux/bash

Stormvirux provided this nice script in another thread. It puts column headings on the output of an ls -l listing: #!/bin/bash { echo Permissions links Owner Group Size Last_modMonth Last_modTime ...
0
votes
0answers
18 views

Is it possible to create an alias to rlogin and pass login paramteres?

There is a system I need to rlogin to for work, and each time it asks for my username and password and after the login I have to type in a code-word in order to get to the view I want. Is it possible ...
8
votes
3answers
123 views

Resolve all aliases in a zsh command line

I have nested aliases and I want to resolve all of them before executing the command. How do I do that? If there is a function that is not bound to any keys then M-x foobar is fine for me too. I ...
0
votes
1answer
25 views

Creating multiple temporary aliases

I am not a root user & I don't have access to the global alias file which has all the aliases created. But I want to create some aliases which remain active only for the session I am logged in. ...
1
vote
2answers
75 views

Why does sudo ignore aliases?

I am running Ubuntu 10.04 and I use upstart for daemon management. My enterprise application is run as a daemon and must be run as root because of various privileges. E.g.: sudo start ...
3
votes
1answer
50 views

scp to an alias

To transfer a folder from my local host to a remote host, I normally do: $ scp -r myFolder user@host:destFolder/ Trying to make this easier, I aliased the remote host destination: $ alias ...
1
vote
1answer
86 views

Resolve nested aliases to their source commands

I've made several aliases for my convenience.But now I need to be helpful by sending a useful command and it is full of aliases.I've tried doing type u but all it returns is up && ap upgrade ...
0
votes
1answer
74 views

How should I change root@mydomain when I send from mail() php function?

I've installed sendmail in Ubuntu as below: apt-get install sendmail Then I sent an Email to test, I received Email from root <root@mydomain>. I checked the content of /etc/aliases, but it ...
1
vote
3answers
72 views

Creating an alias for a bash script

So I have tried experimented and created an alias in .bashrc. However, when I test out the command I get: [rkahil@netmon3 ~]$ menu -bash: menu: command not found Here is what I have in the .bashrc ...
16
votes
2answers
467 views

How to retrieve lost aliases?

Let me start by saying I know this was dumb. Time and Linux make fools of us all. I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I ...
1
vote
0answers
55 views

alias Not able to execute source command

I am trying to define a following alias in my .aliases file. alias sett 'cleartool setview viewXYZ_!*; cd /path_dir1/dir2/; source ./env/script-name' I use it as sett myview on commnd prompt when I ...
2
votes
1answer
95 views

Why are aliases missing inside of bash command?

When I run in my terminal: alias a list with all my aliases (defined in ~/bashrc and ~/.bash_aliases files) will be displayed on my terminal. That's nice and as expected! But when I run: bash -c ...
5
votes
4answers
152 views

Have xargs use alias instead of binary

Bash 4.2 on CentOS 6.5: In my ~/.bash_profile I have a bunch of aliases, including: alias grep='grep -n --color=always' so that I can get color highlighting and print line numbers automatically ...
4
votes
1answer
145 views

Is there some way to make alias expansion work inside if…fi on Bash?

Check this script: #!/bin/bash if true;then alias WeirdTest='uptime';shopt -s expand_aliases WeirdTest fi WeirdTest The first time WeirdTest is executed it says "command not found".
1
vote
2answers
61 views

alias for a command using !! to recall the last command [duplicate]

This is a follow-up question to Execute a line of commands with one sudo If you want to redo the same command with sudo !! after doing a command like this: echo "something">/path/file You ...
-1
votes
1answer
34 views

Make an alias that does an alias command

I have to make an alias that will do the alias command. It has to "replace" the alias command and the user has to feel no difference..
0
votes
1answer
61 views

How to get the same ls with colors working on both OSX and Ubuntu?

When I want color in Ubuntu I do alias ls='ls --color=always' but on OSX this gives an error ls: illegal option -- - and I need to do alias ls ='ls -G' How can I create an alias with the same ...
0
votes
1answer
45 views

KSH script missinterpreting alias stored in SQL oracle DB

I have stored the path of my file in a table with as an alias (as the complete path was too long for the table's field). However, in my KSH script, when I am doing : nomtmp=`sqlplus -S bla/bla ...
1
vote
0answers
124 views

postfix expand ldap group AND afterwards resolve alias

We have a postfix server which has the user config stored in a openldap directory. Recently we also implemented ldap groups which are expanded by postfix. This works fine, unless the group expands to ...
7
votes
2answers
935 views

alias vs export for simple commands

For simple commands like less, is it better to make an alias or to export the options? Is there any benefit of one over the other? For example, if I want less to always use the -R option to show raw ...
1
vote
3answers
90 views

Why doesn't my command work when aliased?

I use ps -ef | grep catalina | grep -v grep to print the tomcat process running on the system: kshitiz 7099 1 0 May11 ? 00:02:29 /usr/lib/jvm/jdk1.8.0/bin/java ...
0
votes
1answer
46 views

Set alias which doesn't send specified text? [closed]

EDIT I set a alias task in ~/.bashrc. The following: alias join="clear; screen -ls; screen -rx [<ID_OF_THE_RUNNING_SCREEN> quit]" If i the task join is executed, the following has to ...
10
votes
2answers
432 views

How to document my custom bash functions and aliases?

Problem: I have multiple bash functions and aliases. I can't remember all of them off the top of my head, so I usually end up opening my .bash_functions and .bash_aliases files to find what I need. ...
4
votes
2answers
58 views

Generating commands with variable expansion in a loop

I want to create local aliases while I work in certain directories. For example, I would like to have the following in a file named local_alias alias foo='bar' I wanted to write a cleanup script to ...
1
vote
2answers
131 views

find command throws errors when inside function

I can run the following command in bash without any errors: $ find /d/Code/Web/Development/Source/ \( -name '*.cs' -o -name '*.cshtml' \) -exec grep -IH UserProfileModel {} \; I wrote a function in ...
0
votes
2answers
52 views

How can I cp different files to an alias that is changing

I would like to be able to replace cp x.x ~/some/long/directory/that/is/deeply/nested/ with cp x.x s1 where s1 is an alias that points to /some/long/directory/that/is/deeply/nested/ However the ...
0
votes
1answer
28 views

Whitelist virtual_alias_maps

I have one mailbox in postfix and several aliases to it. Is it possible to create whitelists for specific alias in order to allow only the addresses from the list to send messages. For example: ...
4
votes
1answer
269 views

Help writing bash function as one-line alias

How do I write this as an alias? p() { DIR=~/projects/$@ pushd "$DIR" } This is as far as I got, but it's piping stdin to pushd instead of xargs: alias p="xargs printf ~/projects/%s | ...
2
votes
3answers
71 views

How can I use an “alias” for the destination directory when copying?

I frequently edit startup files such as my .bashrc file Then I copy them to another direction such as ~/Dropnot/level1/setups/bash1 Is there any way I can cp such files to the above location with ...
6
votes
1answer
94 views

What are the side effects of having several UNIX users share one UID?

The sys-apps/shadow package on my GNU / Linux system comes with a useradd command that supports an option that I have previously overlooked: --non-unique. For the sake of convenience when shellig home ...
3
votes
1answer
50 views

Customize bash to always include a certain parameter

When using the "ls" command, bash prints in the following format: file1 file2 file3 file4 file5 file6 file7 file8 But when given the parameter "-1", it prints: file1 file2 file3 etc... Is there ...
8
votes
5answers
190 views

How can I “stack” shell aliases?

In my .profile (sourced in sh emulation mode from my .zshrc) I have the following snippet: if [ -f /usr/bin/pacmatic ]; then alias pacman=pacmatic fi # Colorized Pacman output alias ...
1
vote
0answers
14 views

sticky alias command [duplicate]

I want to have the alias inst to be used instead of installpkg /tmp/ and then install packages by inst <pkg name>. But in normal alias define, We can not stick alias name to the package name and ...
0
votes
3answers
382 views

How to create a permanent alias without resourcing the .bashrc-like file?

I really like bash aliases, it annoys me that every time I want to add a new alias I have type two commands: echo "alias \"short-cmd\"='long-command'" >> ~/.bash_aliases source ~/.bash_aliases ...
0
votes
3answers
76 views

Assigning a command to variable

I assign command ls to my variable my_File but when I run it as $my_File it does not work. Can you please explain why? #!/bin/bash my_File='ls -f | grep -v '\/'' $my_File
0
votes
1answer
357 views

SUSE Linux 12 - configuring IP alias

I want to setup an IP address alias on a network card. I created a file /etc/sysconfig/network/ifcfg-ens160 and its contents are: BOOTPROTO='static' STARTMODE='onboot' IPADDR='192.168.0.113' ...
0
votes
0answers
23 views

User made host aliases [duplicate]

I would like to set up aliases for hosts /etc/hosts style, but I don't have root privileges. Would I be able to set these up from within my /home directory? How?
4
votes
2answers
460 views

how to make alias to make grep command shorter [duplicate]

In my coding, I always do grep -rnIi "abcabc" . --color But, how to make an alias that can let me type only one word with my search string? Is that possible?