The alias built-in in shells, used to define shortcuts for frequently used commands.

learn more… | top users | synonyms

1
vote
1answer
166 views

How can I add an alias for my pwd to an existing file?

I want to add another alias to my "aliases" file for the directory I'm currently in (Present Working Directory) I've tried printf "alias aaa=cd " + pwd >> myfile It's close, but I end up ...
67
votes
6answers
2k views

Run a command that is shadowed by an alias

Let's say i have the following alias in bash - alias ls='ls --color=auto' - and i want to call ordinary ls without options. Is the only way to do that is to unalias, do the command and then alias ...
2
votes
1answer
154 views

creating shortcuts to executables on IRIX64 6.5

I'm telnetting into an IRIX 64 server and I'm trying to create shortcuts to emacs, gvim, and other executables that are stored in a certain directory. I tried using the alias command on the command ...
3
votes
1answer
582 views

creating abbreviations for commonly used paths

I am new to linux and was wondering whether it is possible to create abbreviations that can be used in terminal. I know about alias command, but am not sure whether that can be used for what I am ...
9
votes
3answers
889 views

How can I find a rogue alias declaration?

I'm trying to find where a specific alias has been declared. I've searched all the usual places I know to look for aliases: ~/.bashrc ~/.bash_profile /etc/bashrc /etc/profile With no luck. I know ...
3
votes
2answers
533 views

List only temporary aliases in bash

I know that to list all aliases in a given bash session with alias -p. Is there a way to get a list of all the temporary aliases in a given bash session, i.e. all aliases that aren't in my bash ...
3
votes
1answer
255 views

Why are these aliases failing?

I am attempting to put some alias definitions in .bashrc. Like this: #Convienience aliases alias ll='ls -l' alias ldir='ls -p | grep "/"' #Temporary aliases alias mvFooLog='mv ~/Projects/Foo/Log.txt ...
2
votes
0answers
355 views

How to enable `sudo` with custom functions?

Recently I learned you can enable sudo for custom aliases as follows: alias sudo='sudo ' # note: the space is required! The reason this works is the following: If the last character of the ...
2
votes
1answer
201 views

Alias in .bashrc doesn't seem to accept an argument [duplicate]

Possible Duplicate: In Bash, when to alias, when to script, and when to write a function? I'm trying to setup an alias in my .bashrc file, but it's not working as expected. I have this ...
5
votes
1answer
882 views

How can I alias to `!!` (last command)?

!! in bash runs last command. I find it too difficult to type given how much I use it. alias to the rescue, I presumed. Or not. I tried: $ alias dl='!!' # Aliasing $ echo Testing123 ...
3
votes
1answer
710 views

Bash: Use an alias in a variable

I am writing a bash script that runs each of its arguments as a command. This works for commands in my PATH, but not for aliases. I can directly call an alias in the script, but I can't call an alias ...
55
votes
21answers
7k views

Quick directory navigation in the terminal

I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/. But I don't want to type cd ...
137
votes
10answers
12k views

In Bash, when to alias, when to script, and when to write a function?

It's taken me almost 10 years of Linux usage to ask this question. It was all trial and error and random late-night internet surfing. But people shouldn't need 10 years for this. If I were just ...
0
votes
1answer
407 views

How do you wrap executable commands so that they work in an alias or function?

I'm still getting around the quirks of shell scripting, but I feel like I'm getting a little more comfortable with it. I've been trying to create an alias to generate a tar file that I have to create ...
7
votes
2answers
1k views

Is a symbolic/soft link similar to a shortcut/alias on a desktop?

It sounds to me like the basic idea of soft/symbolic links compared to shortcuts (on a PC) or aliases (on a Mac) are the same thing. Am I way off? Are they similar?
4
votes
1answer
932 views

Bash alias arguments [duplicate]

Possible Duplicate: How to pass parameters to an alias? I am trying to make a bash alias that will allow me to quickly make an archive of the current git repo. My current alias is: alias ...
1
vote
2answers
910 views

Alias Loop in csh

Why is there an Alias loop error created here: alias df 'printf "\n"; df -hP | column -t' But not here: alias df 'df -hP | column -t' I realize I could call the alias something else and still ...
7
votes
2answers
7k views

How can I install the `ll` command on Mac OS X?

I'm using Mac OS X. When I SSH into servers I find the ll command useful, but it's not available on my local machine. How can I install it?
1
vote
2answers
292 views

Unix alias with parameters [duplicate]

Possible Duplicate: How to pass parameters to an alias? I'm wondering if it is possible to define an alias with parameters. For example, when I have to compile a tex file I execute ...
13
votes
1answer
435 views

Grep alias - line numbers unless it's in a pipeline

I want to create a bash alias for grep that adds line numbers: alias grep='grep -n' But that, of course, adds line numbers to pipelines as well. Most of the time (and no exceptions come to mind) I ...
4
votes
4answers
2k views

How to set an alias for a specific file or directory?

There are several files I work with often. For instance some configuration files or log files. Let's say the Apache log file. I often want to tail or grep it. Instead of writing: tail -50 ...
5
votes
2answers
2k views

watch command alias expansion

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 ...
6
votes
2answers
681 views

Difference between alias in zsh and alias in bash

I have searched around but could not find anything conclusive. Is there a difference between the alias command in zsh and the alias command in bash? If not, does it mean I can share a set of aliases ...
1
vote
1answer
380 views

How do I set Keyboard and profile preferences when connecting to Solaris via SSH?

I'm connecting to a Solaris box from Mac OS X. Whenever I have connected to linux boxes in the past it has been much easier to navigate around. How do I fix these configuration issues on Solaris? ...
5
votes
2answers
4k views

Refresh aliases after defining new command

When I define new alias in .bash_aliases file or new function in .bashrc file is there some refresh command to be able immediately use the new aliases or functions without closing terminal (in my case ...
5
votes
3answers
302 views

For a same unix or linux user, different sets of environment variables

I'm using tcsh, and for a specific project every member of my team connects to a server with the same user. (This is something we cannot change). The situation arises because I want to have some ...
1
vote
2answers
299 views

Simple command that switches between two host files

I am using /etc/host to map localhost to a web domain. I would like a fast way of doing this rather than searching and replacing every time. I put this in my .bashrc file. alias hostchange=' ...
1
vote
0answers
438 views

Dynamic search and replace in Ksh

Machines at work follow a constant naming pattern: host[domain]_[id] where [domain] is either "d" for dev machines and "p" for production machines, and [id] is a 2-digit string that is different for ...
1
vote
1answer
233 views

Error creating an alias for the find command [duplicate]

Possible Duplicate: How to pass parameter to alias? I am trying to shorten the find command, but getting an error: $ alias f='find . -name $1 -print' $ f JobConf.java find: paths must ...
6
votes
6answers
4k views

Show only hidden files (dot files) in ls alias

I'm using the command ls -a | grep '^\.' for showing only the hidden files. I added the line alias hidden='ls -a | grep '^\.'' # show only hidden files to .bash_aliases file but this does not ...
5
votes
1answer
2k views

Alias a command to run in the background

I'd like a keyboard shortcut to work as so: > e foo.txt to expand as > emacs foo.txt & It's simple to use alias e=emacs, but how do I insert the & after the filename? I realize it ...
6
votes
2answers
454 views

What commands have -h human readable option, and how can I enable it by default w/env variable?

I'm tired of using aliases or typing -h. I want human readable output 24/7. Is there a way to enable it all the time for all commands that offer it?
6
votes
2answers
155 views

Aliases interpretation

I have a few aliases in .bash_aliases. I defined c alias as follows, but it does not work as it should ... alias cd='cd; ls -r --time=atime' alias c='cd' ... in .bashrc there is a line alias ...
5
votes
4answers
141 views

Change command-line “environment” to programs command

In a console, is it possible to change into a commands "environment"? To explain, I take "git" as an example. While programming and using a git repository, I change to the repos path and then do many ...
4
votes
2answers
242 views

Combine two commands in .bash_profile

In my .bash_profile file, I'd like to setup a single command alias that is two commands that execute one after another. The first command takes an argument from the command line and the second is ...
2
votes
2answers
708 views

creating simple command for sudo apt-get install?

I need to run these commands very often: sudo apt-get install <package> sudo apt-get remove <package> Can I make it simple like: install <package> remove <package> I ...
0
votes
1answer
931 views

/etc/hosts in debian resets itself on reboot

I've been having a problem where when our vps provider decides to restart the server (running Debian 5.0.8), the server fails to remember changes to /etc/hosts. All I need is an database alias that ...
7
votes
1answer
4k views

How to reset a shell environment?

This issue has been bugging me for a while, and although I've taught I've found my answer through EnvWatcher, unfortunately it only works on Bash. And I use zsh. I would like to replicate the things ...
1
vote
2answers
227 views

How can I add a space automatically after every command I type in bash?

Due to some unknown reason I am not able to edit/delete the last character of any bash command from the bash history i.e. when I access last bash command using 'up' arrow I cannot change or delete the ...
3
votes
1answer
369 views

Git - remove deleted files

I'm using this simple git alias rmdel = "!git rm $(git ls-files -d)" meant "remove deleted", i.e. to remove from the staging area all files deleted from the file system. It works fine except ...
3
votes
1answer
178 views

postfix default alias used even when I have other aliases

I tried adding a rule to /etc/aliases which would send a message to /dev/null if it was sent to a particular alias: fooname: /dev/null I have postfix set up with a default address for a particular ...
2
votes
2answers
300 views

My alias parser works on the command line but not from a script

I'm trying to create a simple script that will dump all my aliases into a file that bash can load when it starts up, while making sure the alias of - to popd works properly: alias -p | sed 's/alias ...
4
votes
1answer
251 views

Preventing use of `cd ..` in bash?

I have set up an alias in my .bashrc as follows: alias u='cd ..' All is well in my world... until I type cd .. and cringe that I did not use my incredible new alias. In fact, with this particular ...
7
votes
2answers
2k views

How do I temporarily bypass an alias in tcsh?

I am using tcsh. bash and zsh and other suggestions won't help here. I have several aliases that are named the same thing as another command, so if I did unalias it, typing the same thing would now ...
7
votes
3answers
290 views

Do you prefer bash scripts or aliases for shortcuts?

I have a ~/bin directory (which is on my PATH) where I store a lot of little 1 or 2 line scripts. Some of them just cd into a directory and run a command on a file, like vim or something. But I also ...
5
votes
1answer
263 views

Does one alias affect another alias?

I don't have many aliases set up in my .bash_aliases file just yet. Only recently have I discovered how useful they can be. I can see myself getting quite hooked on aliases so before the file gets ...
7
votes
3answers
458 views

Forcing an 'added' alias to every command

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 ...
10
votes
2answers
369 views

How to use - as alias?

When I was using openSUSE 11.3, it came with several aliases already set up. Two that I used a lot were + for pushd . and - for popd. Now on Debian, I can't figure out how to create the second one. ...
1
vote
1answer
154 views

Aliases for programs in /sbin/

I have a weird problem, unfortuantely I don't know what I did to cause this, since I tried out lots of stuff on my Linux (Archlinux, 2.6.38 kernel). The problem is: My shell is not finding programs in ...
4
votes
1answer
3k views

How do I get which to show aliases? [duplicate]

Possible Duplicate: How to use which on an aliased command? I'm used to working on systems where which would list aliases, so e.g. if I have an alias like this: alias ...