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

0
votes
2answers
31 views

How do I permanently remove an Alias from my Shell

When I was not near my computer some guy got it and set an Alias for ls in my root folder. He set it to 'yes NeverGonnaGiveYouUp'. So now when im in my root folder and type ls I get an infinite loop ...
0
votes
1answer
39 views

sudo: nocorrect: command not found

I am using zsh and oh-my-zsh on Arch Linux. I am not able to make directory using mkdir edward@ArchLinux ~ $ sudo mkdir -p /samba/raspberry [sudo] password for edward: sudo: nocorrect: command ...
1
vote
2answers
19 views

bash adding a filename to an alias command [duplicate]

I have an alias to a ffmpeg command to start recording a session like this: alias sreq='ffmpeg -f x11grab -r 24 -s 1024x768 -i :0.0 -qp 0 -c:v libx264 -preset veryslow' I can just type sreq ...
0
votes
4answers
32 views

Alias for listing top file and directory consumption - shortest way?

function isaix { echo "alias d='du -sm -- * 2>/dev/null | sort -nr | head -20'" >> ~/.kshrc; } function islinux { echo "alias d='du -sm -- * 2>/dev/null | sort -nr | head -20'" >> ...
0
votes
3answers
24 views

Implementing a command that executes the given command in a certain path and returns to the current path

my code: execInPath() { prev_dir=${PWD##*/} cd $1 shift res=$($@) cd prev_dir echo res } alias path=execInPath $ path ~ ls gives: bash: cd: prev_dir: No such file or directory (and the files in my ...
4
votes
1answer
342 views

How to trigger a 2nd command when a specific command is run in the shell?

I'll explain my question with example. I run $ python manage.py to perform some action. I want to run another command $ xyz , just when any user runs the previous command. Thus, from now on, ...
3
votes
2answers
71 views

Can I concatenate a bash alias?

Sample : to use Composer locally, I must write : php composer.phar After some locals installation of Composer, I want to alias it only "composer" but keeping absolute path with "pwd" command. I ...
1
vote
2answers
43 views

How to define alias for non interactive/non login shell?

I have a user (zabbix) with shell set to /sbin/nologin. The user's home is /var/lib/zabbix and I inserted alias curl='curl -k' into ~zabbix/.bashrc. However it does not work when I (for testing ...
1
vote
1answer
21 views

cshell alias: How to use nested single quotes(') in in cshell alias

I am trying below alias in cshell: alias sll 'ls -l \!* | grep -oE '[^ ]+$' | paste -s | xargs ls -l' For this CSH says, Illegal variable name. If I use \$, alias will be set without any error. ...
10
votes
3answers
280 views

How to extend bash aliases

How to create an alias that actually extends another alias of the same name in Bash? Why: I used to have GREP_OPTIONS set on .bashrc to something like this: GREP_OPTIONS="-I --exclude=\*~" I also ...
1
vote
2answers
25 views

run msfconsole within any directory

I just installed metasploit. The issue is i can only run ./msfconsole in installation directory which is /opt/framework/metasploit-framework. When i run msfconsole in another directory i got this ...
0
votes
0answers
68 views

!-2 not found when using alias [duplicate]

I'm lazy, so I like to make a LOT of aliases for some of my most common shell commands. I use the command sudo !! quite a bit to tack on sudo for root access, but when I use the following in my ...
2
votes
1answer
36 views

Cancel an option used in aliased command?

Suppose for example, the following implementation of ll: alias ls="ls -F -G" # colourise and display dir,exec,etc. icons alias ll="ls -l -h -o" # long-list, use KB,MB,etc. sizes, no ...
0
votes
1answer
48 views

Can I make alias for alias in bash?

In some circumstances, I need to make an official alias for a set of command, which acts just the same as the original software. Like: alias ipython3="source /Users/zen1/miniconda2/bin/activate py3k; ...
4
votes
0answers
51 views

How to track an alias definition in Bash? [duplicate]

This is an alias defined in my Linux shell: $ alias vi alias vi='vim' This alias is so stupid that I want to delete it definitely. Is there a command to find where alias vi='vim' might have been ...
1
vote
1answer
29 views

What's the intended use case for COMPLETE_ALIASES in zsh?

For some months now, I have had setopt completealiases in my .zshrc. I haven't the faintest idea why I added it - most other things have comments or can be understood from neighbouring settings. ...
3
votes
1answer
191 views

Odd alias “find . -name '*\!{*}*' -ls” in Unix Power Tools

From Unix Power Tools 3rd Edition page 175: Article 9.27 shows a way to match directories in the middle of a path. Here's a simpler "find file" alias that can come in very handy: alias ff ...
1
vote
1answer
39 views

How to declare some aliases dynamically in zsh?

I would like to declare a few shortcut commands to switch between my various coding projects, so I have come up with the following script. projects=$(ls -d ~/Workspace/*/) ...
5
votes
2answers
190 views

What is causing `diff` to run `git diff`?

I'd like to use diff as described here and in the documentation I see when I type man diff. However, when I type diff, what I get is this: ~ ❯❯❯ diff usage: git diff --no-index <path> ...
1
vote
3answers
57 views

Bash (Git) - Functions, Alias, and SH script files

I have gotten quite prolific with the use of the aliases, especially with all the different git commands and their order and interdependencies etc. So, I've created a few alias that run more complex ...
2
votes
1answer
41 views

How to create an alias for two Git commands that use a parameter? [duplicate]

I regularly have to delete a local and remote Git branch. Therefore, I run the following commands: $ git branch -d feature-branch $ git push --delete origin feature-branch Since I mostly execute ...
8
votes
1answer
224 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
29 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
50 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
13 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
33 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
52 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
19 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
17 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
27 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
24 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
181 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
57 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
94 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
59 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
54 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
125 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
47 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
85 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
67 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
144 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
115 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
37 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
63 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
202 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
232 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
62 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
53 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
45 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 ...