Say I have set up a few aliases for long bash commands:  alias test1='long-command-1' alias test2='long-command-2'   and so on. Is it possible to list all aliases currently defined (ideally with the command it is an alias for)? Is it possible to undefine (remove) an alias?
123490
I want to remove gs alias from my PC. When I type gs it will open GhostScript. But I checked everywhere in the home directory .alias  .bash_aliases .bashrc  I also overwrite the gs with my custom alias.   I can't remove it. And I also type alias in terminal, in the list I couldn't find it.   Please I want to remove it...
37969
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 had a script (let us say, setup-java.sh) which I would call before working on some Java projects. It would contain the line:  GREP_OPTIONS="$GREP_OPTIONS --exclude-dir=classes"   If I also use Sass, then I would call setup-sass.sh which contains the line:  GREP_OPTIONS="$GREP_OPTIONS --exclude-dir=\*/.sass-cache"   But  and apparently the standard solution is either create an alias or some script...
47927
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 substitute the last command in history to the bashrc file upon shell initialization, and not the actual command that you would get if you were to run sudo !! in an interactive shell. I've also tried alias root="sudo fc -s" to no avail.  I realize this is probably something to do with how the BASH does command substitutions, but can someone explain why this is, and provide a usable substitute?  I'm running BASH version 3.2.51(1)-release (x86_64-apple-darwin13).
22485
In my .zshrc I tried to make a few aliases .I looked into a lot of places, but I couldn't find out a way that worked. I used this code below:    # Set personal aliases, overriding those provided by oh-my-zsh libs,  # plugins, and themes. Aliases can be placed here, though oh-my-zsh  # users are encouraged to define aliases within the ZSH_CUSTOM folder.  # For a full list of active aliases, run alias. # # Example aliases alias zshconfig="mate ~/.zshrc" alias ohmyzsh="mate ~/.oh-my-zsh" alias n= "nano"   alias m= "mkdir" alias w= "cd ~/Documents/UoMWorkspace/Semester2"   alias j= "cd ~/Documents/UoMWorkspace/Semester2/COMP17412"   Then I wrote a command source ~/.zshrc. Still it didn't resolve the issue. I get error messages like zsh: command not found: j  Could anyone help me with any suggestions and let me know what am I doing wrong?
120014
Very useful when you forget a sudo at the beginning of your command, !! acts like an alias of the previous command. Example : $ mv /very/long/path/for/a/protected/sensible/file/caution.h . (...) Permission denined $ sudo !! sudo mv /very/long/path/for(...) . [sudo] password :   How do we call that double !! trick ? Researches over internet are difficult because of that token. How does it work ? I suspect a link with the history command. Where it is defined ? Can I define some other myself ?  EDIT : Some interesting event designators !!:* It refers to the arguments of the previous command. Use case : cat /a/file/to/read/with/long/path nano !!:*  :p Just print the command without executing it, you have to put it at the end of the event designator. $ !-5:p sudo rm /etc/fstab -f  .
65503
ll is a common alias in many Linux distros. How can I tell what it aliases to?   I've tried checking my .bashrc, but I am not able tell what ll is equivalent to.
112843
I want to create an alias for grep like this:   grep argX ~/myfile   where argX is a parameter and myfile is always the same. How can I do this?
111339
Is there a way to substitute aliases such that it is appended or prepended to an existing command in the shell?   For example, defining the alias:  alias execloc='/home/user/'   Prepending this to a command in the bash terminal:  cd exeloc/temp/somefolder   Can something like this be done, or is there a way to do it?
393
For bash script, I can use "$@" to access arguments. What's the equivalent when I use an alias?
60817
One of my favorite Unix tricks is ^x^y, which will take the last command and replace the first instance of "x" with "y". However, I'm wondering if a similar trick works to replace all instances of "x" with "y" in the last command?
25210
When I log in, I see the error:     bash: alias: alias: not found   If I source my .bashrc file, the message appears again.  What is causing this?
50262
In the .bashrc file, one can add an alias for a command, say  alias geditm = 'gedit --display=D1'   Now I can run geditm in a terminal and have gedit open in display D1.  I am curious if there is a way to define an alias for running commands from the Alt-F2 menu, so that I could Alt+F2, type geditm and have the same result.   I am interested in doing this generally, not just for gedit.
113241
I have one-line that I want to call using alias.  while printf '%s ' "$(df -P / | awk 'NR==2 { print $(NF-1) }')"; do sleep 30; done  I tried to escape ' like \' but it didn't work.  What is the correct syntax to use above one-liner in alias?
89504
I have created alias for username and it works fine   alias yb="ssh name@hostname"   It works fine, but I also want to create alias for password, Can anyone help how can I do this?
26639
I was playing around with aliases today and I noticed that aliases don't seem to be available whilst using sudo:  danny@kaon:~$ alias alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l='ls -CF' alias la='ls -A' alias ll='ls -alF' alias ls='ls --color=auto'  danny@kaon:~$ ll -d / drwxr-xr-x 23 root root 4096 2011-01-06 20:29 //  danny@kaon:~$ sudo -i root@kaon:~# ll -d / drwxr-xr-x 23 root root 4096 2011-01-06 20:29 // root@kaon:~# exit logout  danny@kaon:~$ sudo ll -d / sudo: ll: command not found   Is there any reason why you cannot use aliases whilst using sudo?
64283
I have added alias ll='ls -la' in /etc/bash.bashrc but sudo ll is not working. Is there a way to "source" bash.bashrc? In a related post, another user suggesting creating an alias for sudo with a space after it. Eg. alias sudo='sudo ' but there wasn't any context to this answer. Should I add this to my bashrc? Seems hackish.  What is the correct method for adding an alias for my sudo one-off commands?
12192
By typing a manually specified command in terminal I want to execute some other command.  How could add an alias to a command? Can i do that with the help of the terminal or should I edit some kind of file?