Let's say I wish to create an alias for the command: find /path -not -path '*/\.*' Specifically, I'd like an alias nfind so that I can type nfind /my/path Setting: alias nfind='find /path -not -path '*/\.*'' this of course doesn't work, since I have no way to change the /path via calling the alias nfind. Is there a way I can make this happen?
393
For bash script, I can use "$@" to access arguments. What's the equivalent when I use an alias?
40712
Edit: This is a duplicate of .  I don't have the reputation to close this question as duplicate.  I'm not referring to ~ as in the home directory but rather this:  $ ls ~foo/bar /some/mount/point/foo/bar   However if I attempt it with a different mount point, e.g.:  $ mount | ag "/dev " devfs on /dev (devfs, local, nobrowse) $ ls /dev/stdin /dev/stdin $ ls ~stdin zsh: no such user or named directory: stdin .  # bash has a similar error message:  ls: ~stdin: No such file or directory   What is the ~ called in this context?  How does it work?  Edit: More information based on some of the comments below:   I can attest that foo is not a username on my system. When attempting to autocomplete ls -lah ~ not all options are shown.  i.e. I'm able to cd ~qux, when qux doesn't show up in the autocomplete.  Again qux is not a user in my system. If it matters /some/mount/point is a network share. All of the details suggest some named path muckery, a Z shell feature of pathname expansion, but this works in bash as well, which apparently doesn't support things like the Z shell's named paths.
82364
I want to be able to get the nid but the only information I have is .  Is there a way to get either the internal path of /node/*  for that alias if I am not on the page?  Or is there a way to just get the nid from that alias right away?
37677
I am running Ubuntu 10.04 and I use upstart for daemon management.  My enterprise application is run as a daemon and must be run as root because of various privileges.  E.g.:  sudo start my-application-long-ID sudo stop my-application-long-ID etc   I would like to introduce an alias to abbreviate these commands as something like:  alias startapp='sudo start my-application-long-ID'   and run it as startapp and that works but I would prefer to not have sudo in the alias.  alias startapp='start my-application-long-ID'   does not when run using sudo startapp, returning sudo: startapp: command not found.  However, when I added the alias:  alias sudo='sudo '  sudo startapp now works but I am still curious why sudo ignores aliases.
53485
[Reviewers: note that the question was completely rewritten after the close votes.]  I recently found how I can define aliases for bash in the ~/.bashrc.  But since I tried that, I see the followig messages eveery time I open a terminal.  I added some bash aliases to my I was trying to create shortcuts using alias but I unsuccessful and somehow managed to get the message below every time I open up a new terminal.  bash: alias: UIC: not found bash: alias: =: not found bash: alias: sudo openvpn --config ~/vpn/UIC-alopez78.ovpn: not found bash: alias: mat: not found bash: alias: =: not found bash: alias: cd /home/alexisblopez/MATLAB/R2014a/bin/: not found bash: alias: lab: not found bash: alias: =: not found bash: alias: ./matlab: not found ~$    Its's confusing; it does not say error, but because my aliases do not work, I think I did something wrong with them - I don't know what!
118108
I have a directory variable and function as follows:  coding_dir="~/Documents/coding" function f() { cd $1 &amp;&amp; ls -a ; }   And I want to create an alias as follows:  alias rnd="f $coding_dir/random"   But when I try using the alias, I get the following error:  f:cd: no such file or directory: /random   I am aware I could just use the entire directory in the alias, but this was working when I was using bash. How do I get this to work in zsh?
19837
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 of lines, I have to make change in the alias command declaration of d again.  Is there any way I can modify the declaration of an alias so that I don't have to retype the declaration to change the number of lines. Like incorporating passing the number of lines as an argument while declaring alias for d? Or is there some other method to solve this?
60049
I've made several aliases for my convenience.But now I need to be helpful by sending a useful command and it is full of aliases.I've tried doing type u but all it returns is   up &amp;&amp; ap upgrade -y --show-progress &amp;&amp; r &amp;&amp; ap check &amp;&amp; ap autoclean  These are all aliases in u:  alias a='alias' a ap='apt-get' a r='ap autoremove -y' a up='ap update'
11926
I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal  !! and prints   sudo: !!: command not found   If I use double quotes, it substitutes the double bang in the string itself, so that doesn't work.  Is there any way to make this work? Or an alternative alias? `
4502
Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance,  alias vim='vim -X' alias grep='grep -E' alias ls='ls -G'   The problem is that if I want to use which to see where my vim/grep/ls/etc is coming from, the alias gets in the way:  $ which vim vim: aliased to vim -X   This is useful output, but not what I'm looking for in this case; I know vim is aliased to vim -X but I want to know where that vim is coming from.  Short of temporarily un-defining the alias just so I can use which on it, is there an easy way to have which 'unwrap' the alias and run itself on that?  Edit: It seems that which is a shell-builtin with different behaviors across different shells. In Bash, SiegeX's suggestion of the --skip-alias flag works; however, I'm on Zsh. Does something similar exist there?
46798
I used sudo -H gedit /etc/environment command on terminal to permanently change my PATH variable.  To correct it, I pressed Ctrl+Alt+F1, and used export PATH command, but access was denied.   Many commands (including sudo and nano) are not recognized as the new PATH variable doesn't have /usr/bin. I am new to Linux commands.   How can I fix this?
54667
I just wanted to ask whether there is any command which would work on common shells (bash, dash, kornshell)? It is supposed to check if the line variable contains any part of the path.  if [[ $line =~ "$PWD"$ ]] ;then
57053
If a run the watch command containing an alias, it will not expand the alias. I have tried both with single quote and double quotes, in fact given the following alias:  # alias ll alias ll='ls -l --color=tty'   The following command will fail  # watch ll sh: ll: command not found   Shouldn't command line expansion work in this case?
105424
I would like to create a symlink to ~/foo/ but when I write that, ~ is always resolved to the absolute home path. I've used ../s in the past and they work fine, is ~ not allowed?  The reason I'd like to do that is because ~ has a different absolute path depending on the machine and Linux/OSX, but always points to my home directory.  I'd like to include such a link in a git repo sync'd across several machines.
114992
How can I make command aliases in Windows' Command Prompt like I would with bash?  I found out about doskey in , so I can do something like:  doskey ls=dir /b   ...and now the command ls acts a little more like ls on Unix.  (I type ls so often in cmd, it isn't even funny.)  But how do I get this to stick between sessions?  It goes away the next time I open cmd.exe.  (Is there something like .bash_profile?)
85266
Say I have a long path such as:  /a/b/c/d/e/f   I would like to run a command only on each of the subpaths of the path:  e.g. If my command is cmd, I am looking for a one-liner that can do (perhaps using a one-line loop)  cmd /a cmd /a/b cmd /a/b/c cmd /a/b/c/d cmd /a/b/c/d/e cmd /a/b/c/d/e/f   One of the reasons why I need this (I need it for other things as well), is because I would like to give somebody from my unix group the ability to cd incrementally her way to /a/b/c/d/e/f. To do this, I think I need to run chmod g+x on each of these subpaths (not sure if there is an alternative). Note that I want to avoid chmod -R g+x /a.  I work primarily on zsh so I wonder if there is anything that takes advantage of specific zsh features.
108737
Is it possible to forcibly add a timing alias (for lack of a better way to phrase it) to every command in bash? For example, I would like to have a specific user who, whenever a command is run, it is always wrapped either with date before and after, or time. Is this possible, and, if so, how?