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
-1 votes
1 answer
35 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 ...
user avatar
  • 103
0 votes
0 answers
17 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 ...
user avatar
0 votes
1 answer
25 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 && ...
user avatar
  • 31
0 votes
1 answer
24 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 ...
user avatar
0 votes
1 answer
27 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 ...
user avatar
  • 348
0 votes
0 answers
34 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/...
user avatar
  • 153
-1 votes
1 answer
45 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 ...
user avatar
  • 10.9k
0 votes
1 answer
84 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:~' ...
user avatar
0 votes
2 answers
81 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, ...
user avatar
  • 1
1 vote
1 answer
288 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 ...
user avatar
2 votes
1 answer
42 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 { ...
user avatar
0 votes
3 answers
81 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 ...
user avatar
0 votes
0 answers
40 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 ...
user avatar
0 votes
1 answer
130 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 ...
user avatar
  • 3
-1 votes
1 answer
49 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 ...
user avatar
0 votes
2 answers
11 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.
user avatar
0 votes
1 answer
42 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 $(($...
user avatar
  • 101
0 votes
1 answer
53 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. ...
user avatar
0 votes
0 answers
34 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 [...
user avatar
0 votes
1 answer
38 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 ...
user avatar
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....
user avatar
  • 11
1 vote
1 answer
41 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 "...
user avatar
  • 135
3 votes
1 answer
500 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/...
user avatar
  • 133
0 votes
1 answer
46 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 ...
user avatar
  • 111
1 vote
1 answer
69 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 ...
user avatar
  • 111
0 votes
2 answers
109 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 ...
user avatar
  • 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 ...
user avatar
  • 13
0 votes
1 answer
52 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 ...
user avatar
  • 1,042
1 vote
1 answer
27 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 ...
user avatar
  • 145
1 vote
4 answers
74 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 ...
user avatar
  • 41
3 votes
3 answers
268 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,...
user avatar
  • 24.1k
0 votes
2 answers
35 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 "${...
user avatar
4 votes
1 answer
479 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 ...
user avatar
  • 43
1 vote
5 answers
66 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 ...
user avatar
  • 709
0 votes
3 answers
76 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 ...
user avatar
  • 4,473
0 votes
1 answer
69 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 ...
user avatar
0 votes
2 answers
222 views

How can I set an alias for a specific ssh command? [duplicate]

I'm a beginner in Linux, using Ubuntu. I want to make it easier to login to a server using ssh. In my institute, our login command is ssh -Y -p 4022 user@example.com. How can I make an alias for this?
user avatar
1 vote
2 answers
114 views

create an alias on ZSH but need to type it twice

I'm trying to create an alias on ZSH. The aim of the alias is to activate a python virtualenv. I've put a line in my .zshrc alias SOU="source /home/andykw/.zshrc && source $(setopt ...
user avatar
  • 169
0 votes
1 answer
1k views

Why bash aliases commands are not working?

I am facing a problem with bash alias in Kali linux. Let me tell from the beginning. I want to set some command to save time from writing it again and again. So, I used nano /.bash_aliases and set a ...
user avatar
1 vote
2 answers
670 views

Update `.bashrc` and reload

I have a script that inserts some lines to the bottom of my .bashrc, is there a way to source the .bashrc from within the script so that these changes remain once the script has finished? Here's an ...
user avatar
0 votes
1 answer
48 views

fish - Maximum recursion depth reached with tab-complete

With my fish shell, I have defined the alias alias black='command black -l 110' When I type black in my shell and start to tab-complete, I get the error complete: maximum recursion depth reached ...
user avatar
0 votes
1 answer
75 views

Cannot use awk in alias command chain

I'd like to add this command chain to alias to have a shorthand: tail -10000 /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -nr | head -10 However, as alias it does not work as ...
user avatar
  • 223
0 votes
1 answer
721 views

How to set python 3 as default interpreter in Linux

I have python 2.x and 3.x installed on my Linux box. but to run the python 3.x I have to type command python3 <cmd> . But i want to update the alias python to point python3 so I don't have to ...
user avatar
1 vote
0 answers
46 views

Using aliases in bash scripts

I have a bash file with a number of functions, which I source from my .bashrc. Have a print_text function to print some text to which I associate an alias ptx. The alias is used in a number of ...
user avatar
  • 155
2 votes
4 answers
323 views

fish shell alias only in specific directory

I am using fish and am working on a project with a script that's frequently invoked for build tasks called x.py. I'd like to create an alias that maps x to ./x.py. However, I only want this to apply ...
user avatar
1 vote
0 answers
54 views

!!: command not found

Recently, I was getting a bit frustrated about not running commands as admin, and started using sudo !! a lot. I decided that, for ease of use, I'd create an alias ffs for that exact line. I added the ...
user avatar
  • 113
0 votes
2 answers
102 views

Finding duplicate aliases and functions in a script (.bashrc etc)

This site says that functions are faster than aliases, but he rightly points out that aliases are easier to understand - when you want something very simple and do not need to consider passing ...
user avatar
  • 559
0 votes
2 answers
61 views

bash, pass an argument to the 'history' command

I do the following to make history more sensible (i.e. seeing when a command is run can be fairly critical when troubleshooting) shopt -s histappend; # Append commands to the bash history (~/....
user avatar
  • 559
0 votes
1 answer
121 views

alias for podman docker-compose -H unix:///run/user/$UID/podman/podman.sock up -d

This command runs containers using podman rootless with docker-compose. Is it possible to create an alias for this? docker-compose -H unix:///run/user/$UID/podman/podman.sock up -d
user avatar
0 votes
1 answer
49 views

Can I define an alias in bashrc in an incremental way?

In my .bashrc, at the moment, I have something like this: if [ -x /usr/bin/dircolors ]; then # ... alias ls='ls --color=auto -F' # ... fi # xxx alias ll='ls -AltF' Now let's say that I ...
user avatar
  • 1,012

1
2 3 4 5
17