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

learn more… | top users | synonyms

0
votes
1answer
22 views

Aliasing a command with parameter supplied to another command

Namely: I want to alias tail -f to less +F but let tail with any other parameter supplied work the same way as before.
2
votes
1answer
95 views

grom() keyword in bash throws unexpected '(' token

I'm not entirely sure why I'm getting the error in my .bash_profile syntax error near unexpected token `(' when I use the keyword grom() for my function. I wanted to create a bash function that ...
2
votes
1answer
233 views

alias -g '${1+“$@”}'='“$@”', what does it do?

Most makefile have this strange set of symbols '${1+"$@"}'. $@ is the makefile target filename. But why does, people try to use the complex symbol like '${1+"$@"}'?
1
vote
1answer
41 views

What is an alias really doing?

I'm looking for a way to check what an alias is really doing, without having to check the ${HOME}/.profile file, or whatever other file where you can define an alias. For example, if I run ll and I ...
0
votes
1answer
56 views

The Alias directive will probably never match because it overlaps an earlier Alias

Here's the original post on Serverfault: The first 15 lines of my httpd.conf file ServerSignature Off ServerTokens Prod ServerRoot "/etc/httpd" Listen *:80 Listen *:443 User apache Group apache ...
1
vote
2answers
43 views

Single or Double quotes when defining an alias?

I know that contents of double quotes are expanded, whereas the contents of single quotes are not, such that echo '$1' gives $1 where as echo "$1" gives <the argument - blank in this ...
1
vote
2answers
48 views

Bash: How to create an alias in .bashrc for awk with parameters

I'm trying to add an alias in .bashrc file as follows: ... alias cutf="_cutf" ... _cutf() { awk 'NR >= $2 && NR <= $3 { print }' < $1 } (The function's goal is to show the ...
3
votes
1answer
67 views

How to swap two commands in bash?

Say I have command A and command B but I want B to run when I type A and vice versa. I've tried alias A='B' alias B='A' But this doesn't seem to work for some reason. How do I do this? EDIT: ...
-1
votes
1answer
40 views

Alias to create and cd into directory [duplicate]

How can I create a reliable alias or function that let me create and cd into one directory? I tried the following, but, as an example can't create directories with spaces. mcd () { mkdir $1 ...
1
vote
1answer
46 views

How to correctly deploy/install scripts?

I've developed several utility scripts that solve specific problems of my team's day-to-day work. Up to now, what I have done to deploy the script in my co-workers' laptops is as follows: Every ...
2
votes
2answers
241 views

How to create permanent aliases on Unix-like systems?

I am looking for a simple way to create a permanent alias for all users. So ~/.bashrc or ~/.bash_profile is not an option. Hasn't anybody created a program for this? I think it should be a very ...
0
votes
2answers
42 views

process substitution for opening a list of files with an application

I wish to use process substitution to direct a list of files (produced, for example, by ls or find) to a particular application for opening/viewing. While piping such a list to xargs is suitable for a ...
0
votes
1answer
33 views

Universal .bashrc alias showing results of sysytemctl start command

This is small .bashrc alias that allows me to see results of starting service alias systemctl start apache='systemctl start apache && echo SUCCESS || echo failure' How can i modify to work ...
8
votes
2answers
452 views

Run another command before running the command the user wants to run

Let's say I want to modify the original behavior of the ls tool this way: $ ls Hello World file1 file2 ... How can I do this? When running ls I would like to run another command let's say echo ...
0
votes
0answers
45 views

Create an alias using Command, Option, Control, or Fn key as part of the input

How can we map these keys into part of an alias or custom shortcut within the terminal? Is it the key codes that must be used or is there another way?
3
votes
2answers
66 views

Why alias inside function does not work?

See the code below: a()(alias x=echo\ hi;type x;alias;x);a I have an alias inside a function, I do not want to change the external environment (that is why I am using () instead of {}), even the ...
0
votes
1answer
65 views

make custom commands on android 4.4.2

I want to program and debug in my android phone. To do that I downloaded c4droid and it's gcc plugin. after a lot of tries I understood that gcc is in directory ...
-1
votes
1answer
121 views

How does this bash alias to repeat the last command as sudo work? [duplicate]

I recently came across this ingenious bash alias to repeat the last issued command, but as sudo. This could be done by using sudo !! directly in the terminal after the failed command. The alias I ...
0
votes
0answers
27 views

Broken mkdir command [duplicate]

I made an alias in my .bash_profile file with the same name as mkdir. It looked like this. alias mkdir='function _blah(){ mkdir "$1"; cd "$1" };_blah' After removing it, i notice that mkdir still ...
0
votes
1answer
54 views

how to find file defining an alias

I am having a problem I'm not sure how to get around. Somehwhere on my system, I have an alias defined as such: alias subl=\''/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'\' I ...
6
votes
4answers
384 views

Command line shortcuts for changing directory

I'm looking for an easy way to navigate to directories spanning multiple hard drives and want to set something equivalent to a shortcut within the terminal. In Windows I would accomplish this with ...
1
vote
1answer
20 views

How do I make an alias to substitute single word in a piped command? [duplicate]

I use aliases a lot but right now only for use cases like alias i='sudo apt-get install -y'. I often would like to add an alias in the following form: alias cmd='echo [something] >> ...
1
vote
1answer
87 views

Alias for perl script

So far while surfing web I've discovered nice addition to my gpg password generator and I've decided to adjust my alias with these commands. Here is the code gpg --gen-random 1 20 | perl -ne'print ...
0
votes
0answers
41 views

Setting different path for installation in python packaging

I am new to python packaging. My Command Line Interface (CLI) named virtdc modules has to be installed in /var/lib/virtdc. virtdc is the top folder structure /var/lib/virtdc/ framework/ ...
0
votes
1answer
44 views

ksh your own shortcuts, aliases, settings each login?

I need to set up some handy dandy keyboard shortcuts as I am fed up with setting up various aliases each login time from scratch. what is the most convenient way to do this since I don't have the ...
2
votes
1answer
87 views

calling Bash Function from alias definition

I am using Xilinx ISE, a program that requires to source a vendor script to setup the path for all its tools. Since this script breaks some functionalities of my shell I do not want to source it on ...
2
votes
2answers
106 views

How to create an alias to the directories and copy one file to another?

I want to copy a file from /home/e_empid/file1 to /home/e_empid /dir1/dir2/dir3/Backupfile1. User does not want to write a long command each time. Write a command to set an alias for above action? I ...
2
votes
2answers
277 views

How to create an alias for a sequence of commands? [duplicate]

I know it for one command but how to work with a sequence?
7
votes
3answers
484 views

in Bash, how to not include extra arguments in an alias?

I am trying to do something like alias ftp='echo do not use ftp. Use sftp instead.' just so that ftp will not be accidentally used. But I noticed that ftp abcd.com will cause the command to ...
3
votes
0answers
64 views

parametric aliases in csh to add export command

I'm trying to find a way to translate functions to csh/tcsh aliases, since they lack functions but have parametric aliases. As a first step I'm trying to create an export command. Here's what I've ...
0
votes
1answer
60 views

How can I write an alias for cd such that it will fire ls after going into the directory to which I just cd'ed into? [duplicate]

Lets say I want to do cd home and then ls -lrth. I want these two things combined into a single command. I tried writing an alias, but it didnt work. Can you help me ?
0
votes
1answer
30 views

tcsh alias for cd through path of a port after searching

Now I try to create an alias for this command: alias cdport 'cd `whereis \!^ | awk \'{print $2}\'`' Can't find any good examples of using more than 2 commands in a sequence. How to fix that ...
1
vote
1answer
61 views

How do I define alias with variables which can be changed at runtime?

This is probably a very easy to answer question, but I could not find any questions already asking this due to different wording when writing titles. Running help alias on my bash prompt returns only ...
0
votes
1answer
46 views

Trying to make aliases that open the last modified file

One thing that I frequently do is edit the most recently modified files, so instead of typing "ls -lr" and then "vim lastfile", I thought I would make some shortcuts in my ~/.bash_profile file: alias ...
4
votes
5answers
323 views

how to use regex in alias?

I want to create the alias for the command "ssh user@10.32.44.225" as 10.32.44.225 alias [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9]="ssh user@$0" I have created it, but it is ...
2
votes
1answer
73 views

why completion does not work for all aliases?

In my .bash_aliases file I have couple of aliases, like -- shopt -s expand_aliases alias emx='emacs' alias em='emacs -nw' alias gv='gvim' alias v='vi' alias ev='evince' when I use them and press ...
3
votes
1answer
61 views

Run command with sudo by default

Just one brick missing in my current wall. Feels to me like it should be easy to solve, nevertheless I got some explaining for you to do to make you understand what I want to achieve. I need a linux ...
2
votes
2answers
87 views

An alias for a command to kill stopped jobs

I wanted to add an alias to my .bashrc so that I could kill all stopped jobs with a command like kill_stopped. I am aware that kill `jobs -p` can be used to accomplish this but I'd rather have an ...
2
votes
2answers
87 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 ...
5
votes
1answer
94 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
3answers
626 views

How to escape single quotes correctly creating an alias [duplicate]

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
56 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
493 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
597 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
222 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
3answers
301 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
102 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
39 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 ...
4
votes
3answers
193 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
114 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 ...