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

1
vote
2answers
23 views

how to set alias of command in bash that contains both single and double qoutes [duplicate]

I am not able to set alias of hexdump -e '/1 "%_ax) "' -e '/1 "%02X" "\n"' I have tried following methods but failed: alias analyze=\'hexdump -e '/1 "%_ax) "' -e '/1 "%02X" "\n"'\' (note the ...
0
votes
2answers
31 views

How to override option in aliased command? [duplicate]

I have a rm aliased: alias rm='rm -i' How can I override the -i option when I want to remove a large number of files and I don't want to confirm each deletion?
1
vote
1answer
14 views

Should I set PAGER environment variable, alias or symbolic link?

I noticed that when using aliases, some programs launch pager directly (either from PATH or through PAGER). I'd like to define default pager for all cases, not just when I type the command. Should I ...
2
votes
1answer
29 views

alias ? not working in zsh

I was lead to believe that there were no differences between aliases in zsh and bash, however that appears to not be the case. I had an alias that would help me familiarize myself with the command ...
-1
votes
0answers
24 views

.bashrc - Create an alias for SSH declare Function [duplicate]

So, I have a function: function () { command1; command2; } When I do ssh root@server "$(declare -f function) function parameter" It works fine. So, I want to make it simplier - through an ...
-1
votes
1answer
29 views

All Aliases Stopped working suddenly (Linux Ubuntu 14.04.4 LTS) [closed]

I have been using my system with Ubuntu for almost a year now. I have been using a .bashrc file throughout this time. I have build it according to my needs. Suddenly it stopped working and none of ...
1
vote
1answer
26 views

How to disable an alias in bash for a single command? [duplicate]

Let's say you leave your terminal open and a co-worker comes along and types: alias exit='echo nope' alias unalias='echo nope' alias type='echo nope' alias builtin='echo nope' alias ...
3
votes
1answer
30 views

Does tcsh have an equivalent for “${a:-b}” for default variable assignment like Bash?

I want to do this in one line because I want to use it in my aliases. Can I do this similarly in tcsh ? Using “${a:-b}” for variable assignment in scripts There are some ways of doing it here but ...
-1
votes
1answer
33 views

What characters are allowed in an alias?

I am confused as which are the allowed characters to be used in alias? With a function defined as f(){ echo "yes"; } Is it possible to create an alias like: alias fé='f' ### works alias ...
4
votes
2answers
122 views

show only physical disks when using df and mount

When I use df or mount, I'm most of all interested in physical disk partitions. Nowadays the output of those commands is overwhelmed by temporary and virtual filesystems, cgroups and other things I am ...
0
votes
1answer
18 views

Is it okay to add something non-TLD non-hostname as a host alias?

I added some custom (non-TLD) aliases to my /etc/hosts to get rid of IP addresses in my services configuration files. Are there any caveats/gotchas/security implications i should be aware of?
0
votes
2answers
43 views

A tricky recursive bash alias? install at first use

I wonder if this is possible, make an alias, that does a sudo apt-get to the command if it is not there already, and then realiases itself to stop making this changes. Thus I am looking for this ...
0
votes
1answer
28 views

ssh alias with localhost forwarding

Does anyone know what the best way is to create an ssh alias with a localhost argument? Everything I've searched for only includes host, hostname, etc. Such as: Host example2 Hostname example.com ...
3
votes
1answer
88 views

Why Can't I Call Two Aliases With “;”?

When I try to combine two normal commands using the ; character (eg. ls; cd) it works fine. However, I have two aliases that I've created (stopdev and startdev), and if I try to combine them: ...
1
vote
2answers
42 views

parameter aliases

For example is it possible if I could something like below. alias sd='sudo su - <parameter>' if I write like below in command prompt. $sd parameter It would sudo me to given ID as ...
1
vote
3answers
58 views

What are some of the most useful aliases and bash scripts? [closed]

I just picked up some basic bash over at Codecademy today. I was curious what some commonly-used or personal favorite aliases and bash scripts are out there to put in my bash_profile document. Is ...
0
votes
1answer
17 views

why does /var/mail/{username} = /Users/{username}?

My basic question is why do both of these paths point to home (i.e., ~)? Is it pointing to the same home or is it duplicated? I doubt it's duplicated, so if not, how does cd .. decide which directory ...
-1
votes
1answer
12 views

Creating an alias in linux to remove mutiple files

So I'm new to Linux and I'm looking for a push in the right direction with this. I have to create a couple of new aliases in a new text file, (which I did, using pico) expect for one that has been ...
0
votes
1answer
42 views

Syntax of bash alias definition

I'm using Cygwin, and have installed all the developer packages as well as most if not all of the other packages. When I provide an alias for gcc, I get the error -bash: alias: gcc: not found What ...
2
votes
3answers
94 views

How to alias rm to always confirm

When I use the command rm -rf, I want to make sure a prompt always appears before deleting a file, so I tried adding this to ~/.bashrc alias 'rm -rf'='rm -rfi' But it doesn't work. How can I fix ...
0
votes
2answers
72 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 ...
1
vote
1answer
99 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
26 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
37 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
26 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
365 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
131 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
74 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
39 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
313 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
61 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
40 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
52 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
35 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
309 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
74 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/*/) ...
6
votes
2answers
233 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
91 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 ...
3
votes
1answer
93 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 ...
7
votes
1answer
440 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
71 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
111 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
103 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
25 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
38 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" ...