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

learn more… | top users | synonyms

3
votes
1answer
79 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
33 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
57 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
36 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 ...
7
votes
5answers
157 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
2answers
54 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
54 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
0answers
44 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
221 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?
2
votes
3answers
62 views

How to alias a command with '

I wanted to make an alias turn caps lock off: python -c 'from ctypes import *; X11 = cdll.LoadLibrary("libX11.so.6"); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display, c_uint(0x0100), ...
2
votes
4answers
70 views

Defining aliases for a certain directory

Is there a way to have an alias set for a particular directory and its subdirectories? I know I can put it in my .bashrc file, but I would like it only for a certain directory. Edit: what i mean is ...
1
vote
1answer
26 views

Email server with automatic + sign aliases?

Is there currently a Linux email server that will allow me to replicate how Gmail or Outlook allow aliases. i.e. with Hotmail (which is now Outlook) or Gmail I can sign up on a site and use ...
1
vote
1answer
79 views

How to pass arguments to 'source' command?

My source command in the CShell goes like this : source /directory/of/script/script.csh The script.csh executes and in between, waits for my password to confirm the identity. I am tired of typing ...
3
votes
2answers
58 views

How can I make shell aliases available when shelling out from Vim?

In my .zshrc, I declare some aliases. Eg, which dbstart shows the contents of that alias. If I open vim from that shell, it is a child process. In Vim, I can run shell commands with :! some_command. ...
1
vote
4answers
84 views

How to add an alias without directly editing the `bash_aliases` file?

Is there a way to add an alias from the command line without directly editing the bash_aliases file? To clarify, how can I make a bash script do it without having to enter something along the lines of ...
1
vote
0answers
47 views

Why is Apache not respecting aliased directories?

In ssl_default.conf where Apache serves as an SSL-adding proxy for Django Gunicorn, I have: ... Alias /admin/static/ "/usr/lib/python2.7/dist-packages/django/contrib/admin/static/" ...
2
votes
3answers
42 views

how to prevent alias expansion by `eval` to an arbitrary alias, and keep the endless loop protection on a function?

IMPORTANT: do not use eval! (I learned this later..) In a function, eval expands sleep to its alias, so I prevent the endless loop this way: function FUNCexecEcho() { echo "EXEC: $@"; shopt -u ...
0
votes
1answer
32 views

create an alias that runs a command with string replacement from arguments [duplicate]

I'm trying to write a couple of shortcut aliases to quickly navigate to the httpdocs folders of the various domains and subdomains on my server. basically so I can type something like: $ pwd / $ # ...
1
vote
1answer
53 views

Alias for redirecting both standard output and standard error, as well as sending to background [duplicate]

I am trying to create an alias for redirecting both standard output and standard error of gedit to /dev/null, whilst sending the command to background. This works: $ alias gedit='gedit $1 > ...
1
vote
1answer
70 views

.bash_profile alias escape quotes?

On the rare occasion I use the command line, I usually forget syntax. This is one of those times. I want to add a simple alias to my .bash_profile but no matter what quote method I use, I get an ...
1
vote
1answer
60 views

Getting sudo to work for an alias

I installed Sublime Text 3 in Fedora 20 which has got GNOME, as I couldn't get it being called from terminal I created a .bash_aliases file which a line like this: alias sublime='sublime_text' And ...
20
votes
4answers
2k views

Automatically detect when I typed “vi” but meant “cd”?

Title says it all. About 5 times a day, I type "vi" when I meant "cd", and end up opening a directory in vi. It's making me NUTS. It seems like there should be a way to detect when I type in "vi + ...
5
votes
2answers
185 views

l, ls & la — what are the differences, and are there more of these commands?

So, through typing several commands I've found that there's not only ls, but l and la too. There doesn't appear to be any man entries on Ubuntu 12.14. They all appear to do similar things with minor ...
2
votes
1answer
75 views

BASH_ALIASES not equal to alias

I've just recognized that (in Debian 7, within Bash 4.2.37) the output of BASH_ALIASES isn't equal to that of alias – which, according to gnu.org's Bash Manual, should be the case: ...
2
votes
2answers
27 views

copying from a remote server to my hdd with alias or reducing long file paths

I want to copy files from a remote server to my desktop and vice versa. However, the issue is, my files to be copied from the server have quite long file paths with at least 7-8 subfolders which are ...
3
votes
2answers
93 views

Command substitution interpreting spaces within quotes as argument separators

I'd like an alias that additionally appends itself to ~/.bashrc, e.g. function tailias { $(echo "alias $1='${*:2}'" | tee -a ~/.bashrc) } I'm using tee to split the command to ~/.bashrc while ...
2
votes
1answer
63 views

How to make an alias active in both current session and in .bashrc at same time?

I just found frequently I decide to add an alias for longer time use at the same time use it now. So I have to type the same thing twice, first in current bash session then .bashrc.
1
vote
1answer
71 views

how to check if the kernel support for ip alias?

it surprisingly that I get no explicit results when I googled "kernel ip alias support", and I have looked up the linux network administrator, 3rd edition, it says: check that you have a ...
7
votes
1answer
254 views

Can rm recursively remove empty directories?

In an old version of Unix, the rm command would delete directories if they were empty. From the Research Unix Eighth Edition man page for rm: "If an entry is a directory it is removed only if empty." ...
5
votes
2answers
145 views

Why does !! inside an alias not work?

I have this alias set in my system /etc/bashrc file: alias root="sudo !!" The intention of this being to run the last used command using sudo of course. When used, it of course appears to ...
1
vote
1answer
212 views

ssh into a server using .ssh/config alias & run an alias on the server in the same time

On my laptop Inside ~/.ssh/config file I have this: Host <serverAlias> HostName 127.0.0.1 #Server IP User <username> PreferredAuthentications publickey IdentityFile ...
1
vote
0answers
25 views

Use an alias with watch command [duplicate]

The post repeat command every x seconds shows that watch is the utility that is useful for the invoking a command at fixed interval repeatedly. Now, I have very long commands, and have used aliases ...
3
votes
1answer
69 views

code review: automatic completion for bash aliases

I was reading How do I get bash completion for command aliases? and I thought, that the answer Shawn J. Goff needed a little something: less user setup so I wrote a little script that is intended to ...
0
votes
1answer
101 views

Using alias in another script (ksh)

I'm writing a ksh script, and I'd like to use a command define by an alias in my .profile file, in my script. I tried this command in the folder containing my script, and it works. However, in my ...
1
vote
2answers
112 views

.bashrc execute command after “/bin/bash --login”

I have this alias in my .bashrc: alias s='cd ~/Documents/projects/s && /bin/bash --login && rvm use ruby-1.9' How can I execute the right part after it enters login shell (/bin/bash ...
1
vote
1answer
40 views

How to print a partial list of alias definitions in tcsh?

I'm working on Fedora 18 with tcsh on a network with a lot of pre-defined aliases. I'm adding my own personal aliases as well, but I want to be able to display these in a separate list. Right now I ...
1
vote
1answer
45 views

Making an alias which maps arguments to the middle of the command

I want to alias killapp X to pidof X | xargs kill or kill `pidof X`, but I can't think of a way to do this with just an alias on killapp. How could I do this so I don't have to do killapp X` ?
2
votes
3answers
93 views

How to create a function based on commands not defined yet?

I have some scripts (that are out of my control) that loads some environment settings to my session. So whenever I want to load I have to execute a series of commands: export ...
2
votes
2answers
31 views

alias for 'emacs /usr/local/nagios/etc/objects'

I'm trying to get the following working: alias banana='emacs /usr/local/nagios/etc/objects/' So i want to just type "banana firewall.cfg" to edit this ...
0
votes
2answers
153 views

zsh alias being overridden somehow

I'm on a system running OS X 10.8.5. I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon ...
1
vote
1answer
207 views

Aliases in scripts are not set globally

I know this sound really wierd but this is exactly what happens. I have my .profile and .bashrc file set up in a way that the .bash_aliases file gets executed (checked it with a echo). I do not get ...
0
votes
1answer
270 views

Why alias does not work in AIX (korn shell, .profile)?

I have these files in my home directory: drwxr-xr-x 3 meuser staff 256 Oct 12 13:11 . drwxr-xr-x 102 bin bin 4096 Sep 30 12:28 .. -rw------- 1 meuser staff ...
3
votes
3answers
177 views

How to create a short path?

We have so many useful folders, which are in different path, for our working in Linux. For example : $ cd ~/Documents/Courses/EDX/physics2013/ $ cd ~/Documents/Company/OpenGL/Proj/... $ cd ...
1
vote
1answer
191 views

How to create alias to kill processes running on a TCP/IP port? [duplicate]

What I have: alias killport='sudo kill -9 `sudo fuser -n tcp $1 2> /dev/null`' Problem: Running e.g. killport 8000 doesn't appear to work, though. However, simply running... sudo kill -9 `sudo ...
1
vote
2answers
45 views

What happens to argument in alias after using it once? [duplicate]

Why does this only print arg out once? $ alias test="echo $1 $1 $1" $ test arg arg This is on GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu).
1
vote
1answer
87 views

Find where a bash command is defined or sourced from? [duplicate]

Sometimes I want to know what a command I type into bash actually evaluates to. Usually I can figure out the location of the executable very easily with which. $ which vim /usr/bin/vim But what if ...
3
votes
4answers
300 views

Bash aliases/functions and command line options

I want to set an alias to start nedit together with command line option -noautosave (due to text files up to 500MB). What seemed to be easy: alias nn="nedit -noautosave $1 &" just raises some ...
1
vote
2answers
54 views

Extend one alias in second alias

It is possible to do this: alias tm=cd /opt/tomcat alias tmbin=tm/bin $ tmbin $pwd /opt/tomcat/bin ?? I know that I can do: alias tmbin=tm;cd bin