bash-alias

Unable to use scp with a bash alias

The code does not work scp ~/Desktop/favicon.ico nameOfBashAlias:/public_html/mySite/templates/blog/ The alias is alias nameOfBashAlias='ssh [email protected]' How can you solve the problem? [edit] Is a similar code to the following code possible, like running many bashes? scp ~/Desktop/favicon.ico (nameOfBashAlias)>:/pub...

about .bash_profile, .bashrc, and where should alias be written in?

it seems that if i use alias ls='ls -F' inside of .bashrc on Mac OS X, then the newly created shell will not have that alias. I need to type bash again and that alias will be in effect. and if i log into linux on the hosting company, the .bashrc has a comment line that says: for non-login shell and .bash_profile has a comment fo...

How do I include parameters in a bash alias?

Trying to create: alias mcd="mkdir $1; cd $1" Getting: $ mcd foo usage: mkdir [-pv] [-m mode] directory ... -bash: foo: command not found What am I doing wrong? ...

how to automatically ignore files in grep

Is there any way I could use grep to ignore some files when searching something, something equivalent to svnignore or gitignore? I usually use something like this when searching source code. grep -r something * | grep -v ignore_file1 | grep -v ignore_file2 Even if I could set up an alias to grep to ignore these files would be good. ...

single quotes not working in shell script

I have a .bash_profile script and I can't get the following to work alias lsls='ls -l | sort -n +4' when I type the alias lsls it does the sort but then posts this error message "-bash: +4: command not found" How do I get the alias to work with '+4'? It works when type ls -l | sort -n +4 in the command line I'm in OS X 10.4 Than...

BASH configration question, set alias as a sequence of commands?

I know how to config aliases in bash but is there a way to configure an alias for a sequence of commands? i.e say I want one command to change to a particular directory, then run another command In addition, is there a way to setup a command that runs "sudo mycommand" then enters the password? In the MSDOS days I'd be looking for a .bat...

Make "make" default to "make -j 8"

Is there a way that I can make $ make default to: $ make -j 8 ? Thanks! ...

want to set an ls alias, to take parameters

i have the following alias set in my .bashrc: alias la='ls -laG' but i would really like to issue a command thusly: la foo/bar i guess i have to write a shell script? or is there some xargs way? ...

How to set an alias inside a bash shell script

OSX: This works from the command line: alias ruby="/opt/local/bin/ruby1.9" but in side a shell script, it has no effect. I want to write a script that will switch between ruby 1.8 and ruby 1.9, so this needs to be a script - not in my profile. It appears "source script.sh" works, but "./script.sh". Why is this? How can I replicate...

Can't get expand_aliases to take effect

I can't get expand_aliases to take effect in bash. I've tried a lot of different things, and nothing works. Here's the simple test case: /bin/bash -c 'shopt -s expand_aliases; alias cdtmp="cd /tmp"; alias; cdtmp; pwd;' And the output: $ /bin/bash -c 'shopt -s expand_aliases; alias cdtmp="cd /tmp"; alias; cdtmp; pwd;' alias cdtmp='c...

May I define aliases elsewhere than into .bashrc ?

We are several persons using the same login id on Linux Box. I want to define my own aliases without interfering with anyone. In the .bashrc, I define a alias to my bash file defining my own aliases. alias luc=/full/path/to/my/def_alias_luc.sh The file /full/path/to/my/def_alias_luc.sh contains #!/bin/bash echo "" echo "Defining Lu...

How to find out where alias (in the bash sense) is defined when running Terminal in Mac OS X

How can I find out where an alias is defined on my system? I am referring to the kind of alias that is used within a Terminal session launched from Mac OS X (10.6.3). For example, if I enter the alias command with no parameters at a Terminal command prompt, I get a list of aliases that I have set, for example, this is one of them alia...

Bash alias to open Vim at last cursor position mark

The mark " in Vim takes you to your last cursor position. I want to create an alias that will open my Vim instance and jump to that mark; something which is obviously extremely useful. This works from the command line: $ vim -c "'\"" File.cpp Now I want to make an alias for this: $ alias v='vim -c "'\""' Well that's not goin...

String concatenation for a bash script command

I'm trying to write an alias in my ~/.bashrc of this form: alias a="foo; osascript -e 'tell application "Terminal" to do script "bar"; baz" (where bar launches in a new Terminal window, as per this question) but this string doesn't look like it will parse. I tried string interpolation (${str}), but the problem seems to be unsolvable t...

What's the most efficient way to get a sorted, human-readable du output on Mac OS 10.6?

I used to have this sweet alias for du I called dusort that would print out a human-readable list of sizes for the top-level subdirectories+files sorted by size. It was like a mini-filelight for mac that runs in terminal. But now my alias is broken after I copied it to my new mac running Mac OS 10.6. Apparently the sort I used either ca...

bash alias with argument and autocompletion

I have a bunch of scripts in directory that exists on the path, so I can access each wherever I am. Sometime those are very simple util scripts that "vims" the file. From time to time I would like to quickly see the content of script file and see path to file the script opens (then make cat, grep ...). I would like to make an alias whi...

create alias with argument

I want an alias that produce folowing result: $cd /home/ok [clear screen] /home/ok total 452K -rwx--x--x 1 user gigl 16K Oct 1 14:08 ok0 drwx------ 5 user gigl 0 Oct 1 14:02 ok1 drwx------ 5 user gigl 0 Oct 1 13:59 ok2 drwx------ 9 user gigl 0 Oct 1 14:01 ok3 -rw------- 1 user gigl 32 Sep 30 14:36 ok4 I did a script l...

How to add/use a variable to my bashrc file?

I'm a newbie to Linux operating system I need to do the following:- I have multiple projects under "~/myprojects" Think of like >ls ~/myprojects project1 project2i newproject project_possible.... All my projects have a fixed structure see as below:- ls ~/myprojects/ src lib inc common test_scripts (all these are directories hav...