Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [alias]

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.

0
votes
2answers
19 views

How to find out where my alias are defined in CentOS? [duplicate]

I'm a CentOS user. In my machine, some aliases are available, they were previously defined in the past. I want to add new aliases to function as shortcuts to frequently used commands. I don't know ...
0
votes
1answer
13 views

Date not updating in .alias

I have an alias file with the following line: alias ss="import /home/User/Pictures/screenshots/screenshot-$( date '+%Y-%m-%d-%H-%M-%S.png' )" In terminal, when I type "ss" it runs the command and ...
0
votes
2answers
31 views

Why is an alias in a script being sourced in an interactive bash process not expanded?

$ alias bb=hello $ cat test.sh #! /bin/bash alias bb echo "$bb" $ ./test.sh ./test.sh: line 3: alias: bb: not found Is it because alias is not inherited by a child bash process for the script ...
0
votes
0answers
23 views

Creating alias with single parameter used in multiple places

I have been reading the various solutions here using both functions and aliases, but I just can't get them to work for me (most likely my lack of experience in this area, please bear that in mind when ...
0
votes
1answer
26 views

Touch and open file in same command alias [duplicate]

I find myself typing these commands a lot (on Mac): $ touch example.txt $ open example.txt I was wondering if there was an easier way to do this. I tried this: $ alias t='touch $0 && open $...
0
votes
3answers
51 views

Is there a way I can tab between screens without pressing ctrl-a tab every time?

Essentially I just want to press Ctrl+Tab, not Ctrl+A then Tab. I don't believe this can be accomplished with an alias, but have read some stuff about maybe using stty? But I've never used stty and ...
-2
votes
0answers
29 views

Im trying to answer a question and having difficulty myself? [migrated]

Create hardlinks instead of copying files with rsync Please note I cannot comment and I can only answer or Hijack answers because the sites flaws at inception. The question is not only how do I ...
0
votes
3answers
52 views

SSH with Command Doesn't Run as an Alias

I have the following command to remote into a local server and tail -f the latest log file for an application that I have. The command works perfectly fine from the command line - ssh user@hostname ...
4
votes
3answers
402 views

Use alias and carry it on

Let's say I have this alias in my .bashrc alias somedir="cd /var/www/site" how can I use somedir in say ... a cd command? e.g. cd somedir/app/ doing this currently returns: -bash: cd: somedir/...
0
votes
0answers
10 views

Unable to source file with aliases in zsh on MacOS [duplicate]

I have created a file with some aliases that I need to from time to time. These aliases are simple kubectl port forwarding commands. For the test purpose, I have left only one alias in the file: ...
2
votes
1answer
80 views

OpenBSD - How does one set an alias?

I am running the latest OpenBSD and I cannot figure out how to set a simple alias, something along the lines of cls=clear. I've tried putting it in ~/.cshrc and in ~/.profile. I've tried: alias cls ...
0
votes
1answer
46 views

bash: alias: : not found

I am using ubuntu 18.01,when I add below command to ~/.bashrc with vim: # myself add alias lsa='ls -lart'   alias lsl='ls -lrt'    alias lm='ls -al|more' for example: # some more ls aliases alias ...
0
votes
0answers
15 views

tcsh tab auto completion to match the MIDDLE part of the file name in the folder?

I have searched through google and So, while there is no hit for the auto completion function for tcsh that can do something similar to zsh that: when doing 'cd' or 'ls' you can match the MIDDLE ...
1
vote
2answers
28 views

How do I update this recursive directory file search for input and name outputs to handle the below case

I am updating a script that recursively goes through a directory and ocrs the pdf and updates the pdf. In its simple version, it works. ocrmypdf -l vie --deskew --clean --force-ocr --sidecar ...
2
votes
3answers
286 views

type ls command [duplicate]

so i studied somewhere about the type command and came to know that type command can provide the location of command used with it,more specifically the location of the executable file associated with ...
0
votes
1answer
51 views

Matlab application command alias creation error in Ubuntu 18.04

I had installed MATLAB 2017b in my Ubuntu 18.04 PC and am able to execute it as : sudo /usr/local/MATLAB/R2017b/bin/matlab -desktop I intend to install another version sometime in the future as well....
2
votes
1answer
59 views

Using heredoc in zsh aliases

I would like to use heredoc in a zsh alias, for example: alias runthing="cd ~; date << HERE date HERE" However every time I run this alias, the shell acts as if I have not terminated the ...
0
votes
2answers
31 views

Configuring .ssh/config to forward host aliases to a remote host?

We use jump hosts to access our hardware. These hosts are short-lived (less than a day), and are different every time they're generated. I would like to be able to configure my local .ssh/config file ...
0
votes
3answers
91 views

Why doesn't root alias vi to vim if it's standard for other users?

On centos (and I believe many other distros) vi is aliased to vim for all users by default. However, for whatever reason vi is not aliased to vim for the root user, something that always annoys me ...
0
votes
1answer
59 views

How to use aliases with auto completion in oh-my-zsh?

I'm using zsh on MacOS El Capitan. I'm wondering how auto completion has to be parameterized to resolve aliases as well. When I used bash, my .bash_profile contained the following: alias mdb "mongo -...
0
votes
2answers
60 views

To create an alias for grep and to exclude svn directory

To create an alias for grep and to exclude svn directory (currently no questions cover this) on bash env I did: $ function gp {grep -rnIi --exclude-dir='.svn';} However, I get error bash: syntax ...
3
votes
1answer
35 views

How can I alias a history expansion in zsh?

I want this to work (it needs extendedglob and histsubstpattern): alias ri='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}' But it doesn't: $ alias sss='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}' ...
1
vote
3answers
65 views

tcsh alias with complex cmds, quotes and cmd arguments

I'm tying to alias a set of pipe commands, went thru some of the threads here and found that cmd line should be used differently. instead of $1 use !:1 but it doesn't seem to work for me in the below ...
14
votes
4answers
4k views

Would globally aliasing the fork bomb prevent its execution?

If you were to globally set alias ':(){ :|:& };:'='echo fork bomb averted' would that be an effective security strategy to avoid the Bash fork bomb execution or would there still be a way to ...
0
votes
2answers
41 views

Setting an alias when double quotes and single quotes both fail

This question is not a duplicate of Why alias behave different than running bash command directly? because I have tried that solution and it hasn't worked. I replaced all my single quotes with double ...
1
vote
4answers
136 views

Get the expansion of an alias (in both bash and zsh)

I want to get the text which an alias expands into. For example, if I have: alias g=hub alias cdh='cd $HOME' I want to have: expand_alias g == hub expand_alias cdh == cd $HOME The tricky thing ...
0
votes
0answers
31 views

What is the correct way to assign a function containing chained commands to an alias in .bashrc?

I wish to invoke an alias as follows: alias_name arg0 arg1 arg2 arg0 = filename arg1 = General string arg2 = String representation of last command The aim is that by calling the alias and passing ...
1
vote
1answer
25 views

OS X command as an Alias fails with the error '9:13: execution error: The variable Base is not defined. (-2753)'

I have a command I'm running in OS X. It works perfectly: $ osascript -e 'quit app "Base"' && cd /Users/davechambers/Library/Android/sdk/platform-tools/ && ./adb pull data/data/uk.co....
1
vote
1answer
27 views

Where to define shell aliases in configs for projects in tmuxinator?

I define Bash aliases in my ~/.tmuxinator/*.yml files like this: pre_window: alias cc=heh/path/that;alias ccc='cc clean; clear; cc' ;alias selenium-restart=bin/docker/restart-selenium-chrome ;alias ...
0
votes
1answer
39 views

Shell Script To CD and Run a Python Script

OK, I know that there is a lot like this question but I literally get nothing. The thing i need is a script that cd's to /home/project then runs python3 pyscript.py I created an alias to cd alias name=...
0
votes
1answer
53 views

How can I improve below alias?

I want to run less -F command on latest updated log file of one binary (which creates logs with names which start with xtest*) which is in logs directory. I was able to create below alias in csh, but ...
0
votes
1answer
81 views

Always exclude path in find command

I have a directory whose contents should never be found by find, so I aliased find like this: alias find='find -not -path "*.sync*"' the issue is that find now complains that operators are not ...
5
votes
3answers
662 views

Bash shadow a command - function with same name as command [duplicate]

I have a function in my .bashrc to automatically sudo to open files that aren't writable by me: vim() { if [ -w "$1" ]; then \vim "$1" else sudo env HOME="$HOME" \vim -u ~/....
4
votes
2answers
1k views

Making alias of rm command [duplicate]

Making alias of rm command so that when rm command is executed it will first copy file to /tmp/recycle_bin and then remove the file. But I'm getting issue in the process. Steps performed by me: I ...
0
votes
2answers
71 views

Alias when not first word: `G='|grep'` then `command G grep-string`

I find myself typing | grep and | less a lot, and was wondering if there was any way to be able to do something like: alias G='| grep -E' # egrep is deprecated alias L='| less' So I could do ...
1
vote
1answer
210 views

Create a recycle bin feature without using functions

I am working on an old linux learning project and one of the tasks is as outlined below: "Create an alias that protects files from permanent deletion my moving them to a directory called .Trash. ...
1
vote
1answer
38 views

Aliased an awk command successfully now won't use OFS [closed]

So I was able to get a command finally with the ability to get and grep the information from a specific file I wanted and then I ran into a problem with alias: find ./ -type f -name filename.ext -...
6
votes
3answers
2k views

-bash: /bin/cd: No such file or directory - automatically execute ls after cd

I accidentially destroyed my cd command. I tried to automatically execute ls after cd is called. I found a post saying that I have to execute alias cd='/bin/cd && /bin/ls', but now I get -...
-4
votes
1answer
43 views

How can I pass aliases from a shell to a script run by it? [duplicate]

$ alias alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' alias egrep='...
0
votes
1answer
41 views

.bash_profile taking in quotes into beginning of alias

Here is a snippet from my .bash_profile: alias hi=“echo hi” alias oe=“open -e” alias u=“cd ..” alias uu="cd ../../“ alias uuu=“cd ../../../“ If I attempt to run a command using ...
1
vote
2answers
84 views

find inside shell function

I try to put find inside function and catch an argument passed to this function with the following minimal work example: function DO { ls $(find . -type f -name "$@" -exec grep -IHl "TODO" {} \;) ...
2
votes
1answer
63 views

Possible to make zsh up-arrow history search detect aliases?

I have git aliased to g. Sometimes I use g, and sometimes I don't. I might run git add file1 and later g add file2. When I want to add file1 again, I might type g add in the zsh prompt, and then ...
1
vote
2answers
49 views

The alias does not work ?

I create an alias in ~/.cshrc like this alias bw "bjobs -w | awk '{print $7}'" but it doesn't work at $7. How do I fix this ?
1
vote
1answer
80 views

creating alias in bashrc in wsl [duplicate]

I'm trying to create alias for for cd command to AppData and %programdata% folders but I got path not found while if I write manual it works, here is what I'm doing: In .bashrc I do alias client= '...
10
votes
4answers
979 views

Where is the script for alias command in Linux? [duplicate]

I want to add an argument to bash alias script so that i can just run alias -p l='ls -l' and it would get added to my .zshrc permenantly. But i am unable to locate the shell script for alias. I ...
1
vote
1answer
35 views

How to refresh an alias each time it is executed

I have this alias to check the temperature of my Raspberry Pi: gpu=$(/opt/vc/bin/vcgencmd measure_temp | awk -F "[= \']" '{print $2}') cpu=$(</sys/class/thermal/thermal_zone0/temp) cpu=$(echo "$...
1
vote
2answers
72 views

Changed the alias of cd command by mistake

I changed the alias for cd command by mistake. The default alias for cd was chdir !* && setprompt before I changed it to some random command by mistake. I tried changing it back to chdir !* &...
0
votes
2answers
260 views

alias for killing all processes of a grep hit [duplicate]

I am trying to make a superkill alias that kills all process that hit a grep match. I'd like to do: superkill ruby And have it kill all processes that match 'ruby' In my .bashrc, I've added this ...
1
vote
1answer
46 views

How can I set up aliases using bash in Solaris 5.10

Environment: SunRay terminal, running on Solaris 5.10 host. SHELL=/bin/bash Goal: set up some aliases for long commands Trying a simple alias: alias p='pwd' I've tried to add this alias to ....
0
votes
0answers
66 views

VS Code use alias from ~/.bashrc in task.json

I alias the path of my cross compiler in my linux system. Now I want use that alias in my task.json of VS Code. So I write this snippet: { "version": "2.0.0", "tasks": [ { ...