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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

Ubuntu - Run executable with customized name from anywhere

I have installed etcher and I can run it from its installation directory (.../balena-etcher-electron-1.7.9-linux-x64/squashfs-root) with the command ./balena-etcher-electron. Well wonderful ! But now ...
0 votes
1 answer
44 views

Add heredoc (<<) to end of alias within function call

I have an alias which is my psql connection string for a database, let's say the alias is this: alias GQQ='psql "host=$host user=$redshift_uname dbname=$redshift_dbname port=$port pass word=$...
1 vote
2 answers
44 views

How can I/Should I default flags when running a command?

For context, I'm using zsh. Every time I use locate, I want to pass the -i and -A flags. Usually, if I can get away with it, I create an alias with the same name as the existing command to do this. ...
1 vote
2 answers
44 views

zsh: alias or shell function to only echo its command line, including shell control characters

Using zsh, I'd like to create an alias or a shell function that operates as follows: I want this alias or shell function to echo its command line without honoring any shell control characters such as &...
  • 405
0 votes
1 answer
17 views

Bash set project-specific aliases, file not found

I am on Windows and using GitBash to run shell scripts in bash that run python scripts. How can I create a project-specific alias to define a specific python environment and run shell scripts through ...
  • 103
1 vote
1 answer
71 views

How not to use nested strong quotes (')

I'm a relatively new user of zsh and don't know too much about shells (unfortunately). Nonetheless, I would like to define an alias in my .bashrc containing a hash. However, zsh doesn't seem to like ...
  • 11
0 votes
0 answers
10 views

Creating an aliases for Google Text-to-Speech [duplicate]

I would like to use Google Text-to-Speech in the Linux terminal by simply copying and pasting text into the terminal as I would if I were using espeak. This command does what I need: gtts-cli 'hello' |...
  • 438
0 votes
0 answers
31 views

Custom alias outside .zshrc but ZSH_CUSTOM doesn't work in kali

For reference this is not a duplicate: I reviewed other Q and A like this but it doesn't work for me. Background: I'm using Kali in parallels. To keep my .zshrc file tidy I decided to mkdir ...
1 vote
3 answers
67 views

How do I make an alias for a command with sudo

I want to add two aliases, so one executes a command when non sudo, and the other executes a command when sudo, like this: alias v = 'nvim' alias 'sudo v' = 'sudo -E nvim ' I also have set alias sudo=...
  • 11
2 votes
0 answers
69 views

"Could not find foo in PATH" - but it's right there

I see the following behavior: $ foo Could not find foo in PATH $ which foo /usr/local/corp/bin/foo $ readlink -f `which foo` /path/to/opt/foo/foo $ /usr/local/corp/bin/foo starting foo, output for foo,...
  • 7,703
0 votes
1 answer
35 views

How do I exactly alias this one liner in bash?

bash alias doesn't like the quotes dpkg-query -W -f '${Installed-Size;8}kb ${Package} ${Version} ${Status}\n' | sort -n | column -t | grep -Pv "(lib*)" | fzf
  • 1
1 vote
1 answer
35 views

fish shell: universal variables and alias not shared between "contexts"

I use fish shell mainly from Rider IDE and iTerm2. I've noticed that every task that implies saving something for future sessions will not operate transparently between the two aforementioned contexts....
1 vote
2 answers
34 views

like history and fc but for a personalized list of useful commands

I have spent a few hours trying to get an easy access to my most useful commands I have to use in a certain environment, I have the "incredible" idea of using history for that purpose, to ...
0 votes
0 answers
37 views

Korn shell (ksh) omits closing quote when displaying aliases

When displaying aliases in Korn shell (ksh) the closing quote is omitted. This happens with both predefined and user-defined aliases: >> alias type r l ltr type='whence -v r='hist -s l='pwd; ls ...
0 votes
2 answers
250 views

How to pass stdin to python script

I'd like to pass input from a shell command over to a python script in an alias that uses a shell command. test.py: import sys print(sys.argv) the alias alias foo='echo $(python test.py $1)' since $ ...
1 vote
1 answer
52 views

How to send output to next input line?

This my snippet alias hst="history 1 -1 | cut -c 8- | uniq | fzf ". when I run hst The output is $ ~ hst (the output from hst) $ This is what I want $ ~ hst $ (the output from hst) Example ...
0 votes
2 answers
53 views

How to get 'man gfind' when I enter 'man find'?

On my new-ish mac os/Darwin system, my find tool is an 11-year-old BSD version. I have used MacPorts to install a more current version: GNU's find, which MacPorts has named gfind, and placed in /opt/...
  • 2,275
1 vote
1 answer
66 views

Bash Alias with Multiple Quotes [duplicate]

As part of my workflow, I tend to ll (alias ll='ls -l') into a directory to see if the files I need are there, and after that, I cd into the same dir to do whatever I had to do. I would like to add an ...
0 votes
0 answers
79 views

Alias added to /etc/bash.bashrc does not work for Debian 11

I have a Debian docker. In one line I define an alias in Dockerfile: RUN echo alias Kill="ps -ef | grep 'dotnet' | grep -v grep | awk '{print $2}' | xargs -r kill -9" >> /etc/bash....
0 votes
1 answer
65 views

Bash alias with a loop, a sudo, pipes, flags, single quotes and double quotes

I want to make a bash alias of the following command, which works typed out on the command line but all my attempts at making an alias have failed. My only diagnosis is that all those nested quotes ...
-1 votes
1 answer
132 views

New Fish-Shell Aliases are ignored

as explained in https://stackoverflow.com/a/2763014/2891692 i created for days many alias in my config file ~/.config/fish/config.fish and it works. every new alias i add today don't work. Example of ...
  • 103
0 votes
0 answers
48 views

using 2 alias together in cshell terminal

lets say I have 2 aliases, each having multiple arguments. It looks somewhat like below example alias s1 "command1 -a -b -c" alias s2 "command2 -d -e -f" now if I run :s1 s2 in ...
0 votes
1 answer
183 views

alias in ash - limitation, syntax issue?

I'm running OpenWRT in a NAS (WD-MBL) and putting together a set of aliases to make maintenance easier via the command line. These work as expected: alias shutdown='sync && wait && ...
  • 31
0 votes
1 answer
50 views

Replace text in terminal

I am using secure copy to copy some data from a server to a folder (let's say: scp name@server.com:/project1/data/ data1/). My question is if it is possible to save the address of the server (in the ...
0 votes
1 answer
69 views

Usig zsh glob variable not expanding inside alias

I want to list and sort by time, all the files matching a certain pattern and then get only the first 20: ls -laths *.txt | head -20 This works well, for example if I create two files: touch 1.txt ...
  • 348
0 votes
0 answers
147 views

When does /usr/share/zsh/vendor-completions get loaded?

As far as I can tell, my .zshrc doesn't manually source anything in /usr/share/zsh/vendor-completions. If I try to write, in my .zshrc, an alias for a command that has completions set up in /usr/share/...
  • 153
-1 votes
1 answer
137 views

bashrc + why source not refresh the .bashrc file

we add the following line to bashrc file alias reboot="echo you not allowed to do reboot on this machine - sorry" so we get more ~/.bashrc # .bashrc # User specific aliases and functions ...
  • 11.4k
0 votes
1 answer
323 views

error using scp in alias: not a regular file

I know questions regarding this error have been asked before - but I can't seem to figure out why this isn't working in this case: for aliases. I have the following alias scpip='scp $1 user@ip.edu:~' ...
0 votes
2 answers
254 views

How do I create a command prefix for bash with an alias?

I'm trying to create a bash alias that would act as a prefix, and could be parsed without needing to use a space. Basically, I have a set of commands that all start with the same first few characters, ...
  • 1
1 vote
1 answer
388 views

bash_aliases and "if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi" meaning

There's a short section in my .bashrc file that I don't understand and I'd like to ask what it means and some syntax explanation. # Alias definitions. # You may want to put all your additions into a ...
2 votes
1 answer
71 views

Making simple backup alias / function?

OK, so all I really want to do is backup single files as a time in the current directory with '.bak' extension. Here is my current function that does this (jsyk, using Rocky Linux): function backup { ...
0 votes
3 answers
266 views

Paths as bash aliases only work in parent directories?

Can bash aliases be paths? Hi and sorry in advance for the noob question. I noticed a strange behavior when using bash aliases. My goal is to use short bash aliases for often used paths, to make ...
0 votes
0 answers
48 views

How to run only a single command in linux?

I want to execute a single command with .bashrc or dotfile support. For eg: Opening Firefox browser by typing firefox. I don't want to open terminal, then execute the command and then exit the ...
0 votes
1 answer
227 views

change rm alias to mv

Reference: how to change `rm` to as a command like `mv ~/ .trash` I would like to implement recycle bin utility in UNIX since UNIX not has one. In .bashrc file I change alias rm='move.sh" as per ...
  • 5
-1 votes
1 answer
57 views

Escape character(single-quotes) not working in Linux alias

I was trying to play around with escape characters in aliases. Here's a simple example : I want to create an alias for echo 'Hello' So I wrote the alias like below : alias sample 'echo \'Hello\' ' But ...
0 votes
2 answers
18 views

How to extend a wild card option to include js and ts

I have an alias set as follows: alias ppp='prettier --write "**/*.js"' I want it also to do all my .ts files. I'm quite inept at wild card expressions sadly.
0 votes
1 answer
113 views

Variable sleep bash alias [duplicate]

So, I'm trying to create an alias which will run a command after sleeping x seconds. alias ls_sleep="sleep $1 && ls" The problem is, $1 is being passed as string and things like $(($...
  • 101
0 votes
1 answer
76 views

Should echo be aliased to printf?

I'm not quite versed on the terminal, but the few things I've known and read lead me to believe that printf is much more powerful and confortable than echo but work for similar (if not same) purposes. ...
0 votes
0 answers
61 views

Why doesn't creating file with echo work for remote directories in this script?

I aliased the following script: #!/usr/bin/bash if [[ -d "template.html" ]]; then : else cp -n /home/$(whoami)/CS/Software/Pollen/template.html . fi /usr/bin/echo "#lang pollen [...
0 votes
1 answer
43 views

How to nest arguments into calling another alias'

I have two alias' (obviously obscured): alias ki='kinit -kt ~/.keytab alexdodd@box' alias pt='function _pritunl() {/Applications/Pritunl.app/Contents/Resources/pritunl-client start ...
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....
  • 11
1 vote
1 answer
72 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 "...
  • 145
3 votes
1 answer
605 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/...
  • 133
0 votes
1 answer
50 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 ...
's user avatar
1 vote
1 answer
91 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 ...
's user avatar
0 votes
2 answers
316 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 ...
  • 153
0 votes
0 answers
29 views

aliases disappear after rebooting [duplicate]

I have set some aliases for some commands to be executed but upon reboot they disappear. I have set them using the command alias *name_of_alias*="command" and they worked until reboot. I am ...
  • 13
0 votes
1 answer
123 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,052
1 vote
1 answer
28 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 ...
  • 145
1 vote
4 answers
86 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 ...
  • 41

1
2 3 4 5
17