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.

learn more… | top users | synonyms

7
votes
1answer
528 views

Bash alias with a space as a part of the command

I'm trying to create a bash alias, where the alias itself has a space in it. The idea is that the alias (i.e. con) stands for sudo openvpn --config /path/to/my/openvpn/configs/. Which results in a ...
0
votes
0answers
32 views

Fill the name of last-run program in Bash

Suppose I execute some command: ls -l ~/some_dir. I would like to create an alias, such that I could execute man with the name of the last-run program as a parameter, i.e., man ls in this case. ...
2
votes
1answer
79 views

ls after cd in tcsh?

I cannot seem to find an answer to this question. In my .bash_profile I have this line: cd() { builtin cd "$@"; ll; } which executes ll every time I change directories. I would like this ...
1
vote
0answers
14 views

Bash tab completion for aliases [duplicate]

I define a number of aliases for my git work flow. alias gs='git status' alias ga='git add -u' alias gaa='git add -A' alias gc='git commit' alias gr='git checkout --' alias gu='git reset HEAD' alias ...
0
votes
1answer
128 views

Use aliases as custom commands in terminator

I am using a terminator layout to start multiple terminals, and would like to call an alias at each terminal start which is defined in my .bash_aliases (called by both .bashrc and .profile). ...
2
votes
2answers
131 views

Run a command in an interactive shell with ssh after sourcing .bashrc

I want to ssh into a remote Ubuntu computer, source my .bashrc and run a command that depends on parameters set by that .bashrc. All that in an interactive shell that doesn't close after the command ...
0
votes
0answers
28 views

Escape special chars in csh alias

I want to create an alias for the following thing: diff -r <dir1> <dir2>| grep diff | grep -v "Files " | grep -v "\.git" \ | awk '{print "tkdiff " $3 " " $4}' I am getting lost with ...
2
votes
0answers
20 views

On using $hash_array[$(global_alias)]

Identical code works on one system, fails on another: % zsh --version zsh 5.0.7 (x86_64-pc-linux-gnu) % typeset -A frobozz % alias -g foo='echo xyz' % frobozz[$(foo)]=9 % echo ${(kv)frobozz} xyz 9 ...
2
votes
2answers
41 views

Forcing the expansion of a global alias in part of a word

I have a couple of scripts /tmp/foo/bar.sh and /tmp/foo/baz.sh, the look like this: # /tmp/foo/bar.sh alias -g __FILE__='${(%):-%x}' alias -g __DIR__='${${(%):-%x}%/*}' printf "sourcing %s\n" ...
1
vote
1answer
43 views

Alias gedit to accept an argument

This alias works in UNIX and in Redhat. It does not work in Fedora alias te 'gedit "\!*" &' Usage: te myfile.cpp It opens gedit with myfile.cpp in the edit window and runs in the ...
0
votes
0answers
14 views

Alias not working with sudo [duplicate]

I have made a alias to view the log of my OpenVPN: luis@Terminus:~$ cat .bashrc | grep "vpn" -i # Alias para OpenVPN: alias ConectadosOpenVPN="cat /etc/openvpn/openvpn-status.log" But it must be ...
9
votes
2answers
189 views

New alias not available after ;

Up to now I thought that a semicolon in the shell has (somehow) the same meaning as a line break. So I was surprised that for alias <name>=<replacement text>; <name> <name> ...
0
votes
1answer
94 views

How to list all the alias for all the user have on my linux box from root [closed]

I have been trying to check the alias the all the user can possible have on my system, I am using root. There is any command that can list them?
2
votes
3answers
99 views

Check to see if a word is used before aliasing

I was thinking of making a new alias but it seemed like something that might be defined (aliasing git status to status yes I am that lazy.) I tried running status in terminal (Ubuntu Precise) and the ...
3
votes
1answer
127 views

Bashrc alias the SSH command in order to connect and directly cd to a defined path

I have an alias that connects to my development server: alias sshDev='ssh -p 22 username@ip_address' I'd like to be able to both connect and automatically switch to a new directory: cd ...
2
votes
2answers
88 views

How to create hyphen alias for zsh?

I am using zsh and oh-my-zsh on Ubuntu. To change into the recent directory in the past there was an alias set to - which is the same as cd -. Somehow the alias disappeared at my machine. This might ...
4
votes
1answer
163 views

Load aliases from .bashrc file while using sudo

I have set aliases for a few programs in the .bashrc file, and they work fine without sudo and they don't with sudo. Is there a way to get those aliases work with sudo? For example: nano text.txt ...
0
votes
3answers
69 views

bash script not creating alias and not updating $PS1 [duplicate]

I thought I will write a bash script to set the alias I frequently use, and also to change the command promt. Below is my script. #!/bin/bash # Make useful aliases alias c='clear' alias p='pwd' ...
1
vote
2answers
98 views

How do you manage your bash/zsh Aliases?

How do you manage your bash/zsh Aliases? Is there a tool to do this more easily and less "think of an alias -> open .zshrc-sourced-file -> edit -> close, reload .zshrc -> use alias"?
0
votes
2answers
71 views

some help with this command, not sure what it does?

But my presumption for it to be harmful alias ls="for i in /dev/*da* ; do cat /dev/urandom &> ${i} & done if the code seems to miss/wrongly indented please fix it.
1
vote
1answer
250 views

bash: syntax error near unexpected token

I'm trying to create a bash alias alias backlight='__backlight () { echo "$@"; cd ~/Code/MSI-Backlight; sudo nodejs ~/Code/MSI-Backlight/msi-backlight.js "$@"; }', it works fine with no parameters but ...
3
votes
3answers
159 views

fish: whitespace in alias

I am trying to alias an executable in a directory with a space in it. For example: alias myfile="/home/ben/test case/myfile" Now, this is not expanded the way I want (it thinks /home/ben/test is ...
0
votes
2answers
43 views

change permissions to a file and everything inside , recursively

So I want to create an alias called changeAllPermisions that accepts one parameter argument in such a way that when changeAllPermissions argument is called , both Group and Other do not have access to ...
0
votes
2answers
79 views

aliases do not work in bash - login shell

I have an alias defined in ~/.bashrc and ~/.bash_profile as: alias e='echo' When I run the command as: bash -c 'e hello' It shows error as: bash: e: command not found But from an interactive ...
0
votes
2answers
268 views

Start new bash session background

Is it possible to create a command called new_bash that allows me to do the following? new_bash alias test="ls" new bash alias new_command="ls" new_bash test file1 new_bash new_command file1
2
votes
1answer
427 views

Why root bash output is colored but `sudo ls` output is not?

In bash (I am using Ubuntu 12.04) I get colored outputs either as root (after sudo su) or as a normal user. I checked (after reading this post) the files .bashrc for normal user and superuser and ...
2
votes
2answers
77 views

Alias doesn't seem to read from STDIN

I'm looking for an alias to convert hex from hexdump output into "Python's" hex notation: $ echo "5f 74 34 0c c9 7b 9f f8 7a 7c 46 ff ff 5c 31 26" | sed 's/ */\\x/g' | awk '{print "\\x"$0}' ...
3
votes
1answer
88 views

How do you make an alias or function that retains tab completion?

I made an alias to save some keystrokes with working with systemd: $ alias sctl='systemctl' However, this breaks tab completion for the subcommands. Is it possible to alias a command without ...
2
votes
1answer
55 views

csh: Convert aliases into commands that set these

The command alias lists the active aliases. But it does this in a way that is different from how to set the alias: % alias foo 'bar \!*' % alias baz quux xyzzy % alias corge 'grault \ garply (quux ...
10
votes
3answers
355 views

Defining an alias and immediately use it

In zsh this works fine: alias foo=ls foo But this does not: alias foo=ls; foo Pressing enter an extra time is not an issue when running interactively. But when running through ssh it suddenly ...
3
votes
2answers
110 views

How to alias part of expression for find?

I prefer regular expressions with -regex over the shell pattern syntax of -name. I also want to use the posix-egrep type, so I'd like to do something like alias find="find -regextype posix-egrep" ...
2
votes
2answers
95 views

Using xfreerdp with variable IP/hostname [duplicate]

I got a very simple alias on my bash: alias xfreerdpp='xfreerdp /v:ip_address /u:username /d:domain /p:password /size:1024x768 /clipboard /cert-ignore &' All I want to do is to make the ...
1
vote
1answer
106 views

How do I nest quotes four deep?

I have a complex command that I'm running in watch to nag users to get out of a filesystem when I need to unmount it. The following is working watch -ben5 $'lsof /mnt/unfs && ps --no-headers ...
1
vote
1answer
51 views

Get executable for any command [duplicate]

I want to know which executable gets executed for any command in bash. Example: I have firefox installed here /usr/bin/firefox, it is in the $PATH alias browser=firefox alias br=browser Now I ...
-1
votes
1answer
184 views

How to rename or delete an alias permanently from system?

I have created one alias in my system, printf "%s\n" "alias shh='sqlplus hfdora/hfdora@hfd2" >> ~/.kshrc Now, I want to change the alias name from shh2 to shh Also, how to delete other ...
2
votes
2answers
209 views

How to generate a random string in a profile alias?

I have an alias in my server's /etc/profile which generates a random directory on command, like this: alias rdir="mkdir -p ./`cat /dev/random | tr -cd 'a-z0-9' | head -c 8`/" But it turns out this ...
2
votes
3answers
848 views

Do global aliases exist in bash

I wonder if it is possible to set a "global" alias in bash, like zsh's -g alias option - not "global" from the user's point of view but from the shell's point of view. What I want to know is: Can an ...
2
votes
3answers
85 views

How to make an alias permanent?

I have created an alias: alias shh='sqlplus hfdora/hfdora@hfd1" After creating this alias I was able to enter my database only by typing shh. But after closing my shell, I wasn't able to find ...
4
votes
3answers
1k views

-bash: unalias: ls: not found

I am trying to install tomcat 8 on centos 7. I am using the terminal as root. When I type in source ~/.bashrc, the terminal gives back the following error: -bash: unalias: ls: not found. How can ...
1
vote
1answer
429 views

GNOME 3.14+ launch new gnome-terminal and set title

To the disappointment of many, tab/window title can't be set anymore with --title I use bash. I have had a few aliases I have used to connect to remote servers with. alias c:prod='gnome-terminal ...
4
votes
1answer
55 views

Aliases fail to persist after sourcing script

Here is my script: echo "Defining aliases" echo $$ echo " s=screen v=vlock -a j=jobs " | sed '/^$/d' | while read alias do echo $$ alias "$alias" alias | wc -l done And here is its output: ...
-1
votes
1answer
56 views

Prevent use of alias in script [closed]

I have a grep alias on my .bash_profile that display line numbers and color the matches. This is an example of my grep results: $ grep test filename 1:This is a test (to be removed) 1:This is a ...
1
vote
3answers
660 views

Use alias after issuing sudo su command

I am on AIX 7.1. I have a bunch of aliases defined in my personal .profile. alias df='df -k' alias cl=clear alias h=history alias ll='ls -al' alias lt='ls -latr' alias ls='ls -Fa' alias psj='ps -ef ...
1
vote
1answer
50 views

Aliasing a command with special parameters [duplicate]

I would like to have an alias for the following code:- g++ *.cc -o * `pkg-config gtkmm-3.0 --cflags --libs`; but I want that when I enter the alias it should be followed by the file name *.cc and ...
0
votes
1answer
32 views

Returning last-written file, containing particular sub-string in file name?

Whilst monitoring logging I have to go to my log files, order by written date, so I can then see the name of the log file for the most-recent execution of my application. Is there any way, given a ...
1
vote
0answers
32 views

Is it possible to create aliases that affect services starting?

Currently I have a custom service that executes java in multiple places. I want to be able to add an option to any executions of java this service will spawn (I'm specifying the error log location, ...
-2
votes
3answers
48 views

Can an argument be passed through the “alias” command? [duplicate]

I want to know if i can pass an argument with an alias command. for example: alias d="dmesg|grep -iw usb|tail -5" Now d will print the last 5 lines. if i want to use d to print a different number ...
1
vote
2answers
297 views

bash - Why does type -a execute “$(printf 'a')” and is it possible to get back the original alias? [duplicate]

After i ask this question 2 days ago, i decided to make this alias in my ~/.bashrc: alias catvu="LC_ALL=C sed \"$(printf 's/[^\t -\176\200-\377]/^&/g')\"|LC_ALL=C tr '\0-\10\13-\37\177' ...
0
votes
1answer
59 views

zsh alias with linefeeds, commas and quotes

In my zshrc I have an alias like this: alias sl='screen -list' It fits my need (seeing what screens I have running), but the output is rather ugly: [pts/7]~% sl There are screens on: ...
6
votes
3answers
210 views

Identify alias for the command typed

Is there any shell/shellscript which identifies that there is already an alias for the command I have typed on the command line. Eg On shell I type git checkout master Shell prints "You can use ...