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.
903
questions
1
vote
0
answers
21
views
Unable to iterate over files using ZSH alias [duplicate]
I have simple command to iterate JPG files
for f in *.JPG;do echo "Processing $f";done
The terminal output is as follows:
Processing IMG_0316.JPG
Processing IMG_0317.JPG
Processing IMG_0318....
1
vote
1
answer
275
views
How to call many shell functions from sudo?
I have a huge alias file sourced by ~/.bashrc or ~/.zshrc which contains both simple aliases and more functions for more complex stuff:
# example aliases
alias "sudo=sudo "
alias "...
3
votes
1
answer
1k
views
How do commands resolve in bash? [duplicate]
When doing
which python, I am getting /usr/bin/python.
When doing
which python3, I am getting /usr/bin/python3.
However, When doing alias python=/usr/bin/python3, still which python returns /usr/bin/...
0
votes
1
answer
63
views
How can I know which are my most used aliases?
I would like to know which aliases I use most often, in both zsh and vim, so I can rename them to have more or fewer letters depending on the use. And also to remove aliases I never use, because I ...
1
vote
1
answer
772
views
How can I get aliases and functions descriptions?
I use oh-my-zsh and I have many aliases and functions I can't remember, so I use alias ag="alias | grep" to find out what an alias does. I also use alias-tips. But instead of getting the ...
0
votes
2
answers
994
views
Bash: Alias not recognized in shell interpolation
~$ bash --version
GNU bash, version 5.1.12(1)-release (x86_64-pc-linux-gnu)
~$ alias bab=python
~$ $(echo bab)
bash: bab: command not found
I'd expect bab to be turned to "python", but it ...
0
votes
1
answer
686
views
Change mount location of an encrypted volume?
I've followed this page to make a partition encrypted.
When I format the created luks volume I do this:
root@M17A:/home/mike# sudo mkfs.ext4 /dev/mapper/cryptpart
mke2fs 1.45.5 (07-Jan-2020)
Creating ...
1
vote
1
answer
50
views
Escaping correctly creating an alias
alias wp='watch -d --interval 1 "oc get pods | grep 0/1 | grep -v Completed | awk {'print \$1,\$2,\$3,\$4'} | column -t "'
I'm trying to escape this command.
I've tried escaping the print ...
1
vote
4
answers
213
views
Alias to create a file with new folder named after ISO date and open the file in vim
I would like to create an alias in .bashrc so that I can create a Markdown or text file in a folder that is named as ISO date with GMT time and then open that file in an editor.
This is an output I ...
4
votes
3
answers
2k
views
Automatically source a file when `cd` into a specific directory
I have couple of utility commands-and-aliases that are generic enough in any directory for my own requirement. But there are certain directory e.g. 'build', where I need a custom behaviour.
To do this,...
0
votes
2
answers
236
views
How do I convert this script into an alias (MacOS, ZSH) [duplicate]
This script works fine when directly typed into the console:
N | find . -type f -iname "*.aac" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -acodec libmp3lame "${...
9
votes
1
answer
6k
views
How to overwrite aliases in my shell (Oh My Zsh)?
I would like to alias my ls command, but there is a previously defined alias for it which I believe gets invoked first before my definition! I am using .zshrc to define my alias, and here is what I ...
1
vote
5
answers
158
views
Connecting to a ssh server based on interface up
I'm trying to make a bash alias that connects via ssh to a server based on the availability of an interface. If the first interface is available, then connect through a specific IP, otherwise connect ...
0
votes
3
answers
358
views
Using `1>&- 2>&- &' as an alias after a shell command
To run a program with bash in background, with no text output, it is possible to use: 1>&- 2>&- &. I would like to define an alias for this. However, if I write in .bashrc
alias ...
0
votes
1
answer
510
views
zsh alias not being unaliased in zshrc
[leading dots elided because I don't want to type them]
An alias--gl--is set to git pull by a plugin in my zshrc. I want to set it to a git log command.
I'm on macOS and, as expected, /etc/zshrc is ...