Questions tagged [alias]
In shells, an alias is an alternate name for a command. For instance, "ll" is an alias for "ls -l" on many systems.
410
questions
4
votes
2
answers
652
views
Show Shell Function in Ubuntu Terminal
Over the years I've moved away from using aliases to defining functions in a .functions file that I source at the time of launching the shell. This works fine, but one feature of alias that I miss is ...
0
votes
1
answer
29
views
changing grep command --color from red to another color [duplicate]
I'm searching from the file using grep command with particular pattern,
sysadmin@localhost:~$ grep bash /etc/passwd
which return the output like below
root:x:0:0:root:/root:/bin/bash ...
0
votes
1
answer
29
views
Custom alias to run and compile .c file
I'm trying to create custom alias to to compile and run my .c files in one command. I tried to add this line in /.bashrc_aliases alias runc='gcc $1 -lm && ./a.out' however I get an error and ...
7
votes
2
answers
1k
views
Should I put functions in .bashrc, .bash_aliases or .profile
I have read this thread about where to put aliases.
Now, let's suppose that my custom command is quite elaborate (takes arguments in input, is composed of several commands run one after the other, I ...
0
votes
1
answer
67
views
Starting an appimage
This may seem like a simple question but I am attempting to create a function in my .bash_aliases that would chmod the appimage as executable then start the appimage.
The function that I have written ...
3
votes
3
answers
677
views
Alias for git commands
Most of the time, I use these git commands :
git add src/ package.json
git commit -m "custom message"
git push origin "name_of_the_branch"
So I want to make a single alias ...
1
vote
1
answer
139
views
Create alias of a command with sudo
I would like to create an alias of the below command with sudo like below.
alias /usr/bin/vmstat='sudo /usr/bin/vmstat'
is it possible to create something like that for a user?
1
vote
1
answer
154
views
Create a bash function with parameters to use as an alias
I have realised that my folders follow a specific structure and wanted to access them with cd faster, so I tried to make this alias / function that would behave like this:
cdc glm 03
would be ...
0
votes
0
answers
10
views
Create a alias using ls | grep | xargs xdg-open [duplicate]
I'm trying to create a alias combining ls | grep | and xargs xdg-open.
This is what I've tried so far. Not sure why it is not working.
alias lso='ls | grep "$1" | xargs -I {} xdg-open {}'
...
0
votes
0
answers
194
views
apache2 The Alias directive in /etc/apache2/conf-enabled/autoindex.conf at line 21 will probably never match because it overlaps an earlier Alias
As delivered on 22.04, in the apache2 package, there is a duplicate alias definitions for /usr/share/httpd/icons. The alias of /icons/ is found in both mods-available/alias.conf and conf-available/...
2
votes
1
answer
510
views
how to add alias to bashrc and load content with sudo?
I need to run my script with sudo, because it includes commands for installing programs with apt. So I do this:
sudo ./myscript.sh
With content:
#!/bin/bash
# add alias .bashrc (work)
echo "...
4
votes
2
answers
666
views
How to printf "`" and "%" character inside array on aliasses?
I have some issues with the button on the keyboard, I have already replaced my keyboard 3 times. I use printf for some text editors temporarily. I need to printf "`" and "%" ...
-1
votes
1
answer
129
views
Can alias be part of the string I type on the command line?
Can I make an alias in the way that it is part of the string I type on the command line? In addition to that, I'd like that alias to have more than one value.
For example, if I enter any of the ...
0
votes
1
answer
273
views
What overwrites an alias created by a file in /etc/profile.d? (environment variables)
I executed the following command to create an alias file in CentOS 7.9:
echo 'alias ll="ls -alhF --color=auto"' > /etc/profile.d/alias-ll.sh
Then once I restarted the shell, "type ...
1
vote
1
answer
245
views
How to list aliases (“alias” command) from within a script
I’d like to execute the “alias” command from within a script. It’s under the “Settings” area for the user. I can execute “env” but would like to follow that with their set aliases that they/I would ...
0
votes
2
answers
181
views
Alias path not found on Ubuntu
I installed kind from kubeflow kind and save it under my $HOME/kubeflow/kind
To run kind from any path, I create an alias in my ~/.bashrc as following:
alias kind="./$HOME/kubeflow/kind"
...
0
votes
2
answers
298
views
Create alias with variable input?
So I've seen a similar question to this, but using fish. I though am using vanilla ubuntu 20 terminal.
What I have is an alias for a directory 1dir='cd such/and/such/and/such', and another for running ...
4
votes
2
answers
2k
views
How to create an alias for a "cat" file usable in a path
I have two huge files (150G each) and I need to use a tool for which I should supply them as a single file (since the tool only accepts one file). However, I do not want to merge these files for ...
1
vote
1
answer
625
views
Can't Create a Permanent Alias In Fish Shell
I'm trying to create a permanent alias. I've created one long ago, but I don't remember if I did anything differently than what I'm doing now. Be as it may, it isn't working!
I start by opening the ...
2
votes
1
answer
977
views
Create an executable that is an alias for another command
I've downloaded Open Video Downloader which is a gui to youtube-dl (which is kinda dead)
I've replaced it with yt-dlp (youtube-dl fork which is working)
My problem is that yt-dlp needs python 3.7+ to ...
0
votes
1
answer
92
views
sudo -s -H and aliases
I often use sudo -s -H, but want to have aliases after executing it
How to?
Explanation:
I log in server as user1 (which is in sudoers). This user has aliases in .bash_aliases:
alias rm='rm -i'
now I ...
-1
votes
1
answer
361
views
Alias to create a Python package
Wondering how to create an alias for creating a Python package. A Python package is nothing more than a folder with an empty __init__.py file inside it. So basically I need something like alias pydir=&...
1
vote
1
answer
1k
views
System doesn't remember alias
Somewhat of a novice here. I recently installed the flatpak Brave browser and since it's tedious to write flatpak run com.brave.Browser every time to run it from the terminal, I tried to create an ...
0
votes
0
answers
23
views
nohup in alias has problem "nohup: missing operand" [duplicate]
Hi I was trying to create an alias to run a shell script in background:
alias inj=nohup ~/software/idea-IU/bin/idea.sh in my ~/.bashrc
But as I type inj in terminal, I got nohup: missing operand error....
1
vote
0
answers
186
views
Setup alias to work immediately when created as root without a restart
I have created a Shell script to install some software which runs as root. As part of this process it sets up an alias to point at a shell script to make it easier to run for the user. It does the by ...
2
votes
3
answers
11k
views
How to give docker-compose alias to the new docker compose (v2) command?
I noticed that docker-compose 1.x is gently being dropped in favor of the new v2:
https://www.docker.com/blog/announcing-compose-v2-general-availability/
So I then removed my docker-compose v1.x ...
0
votes
1
answer
526
views
XAMPP is not working on Ubuntu 20.04.4 LTS
I have been using XAMPP to work on personnal project using PHP.
XAMPP used to work before when I first installed it but now there seems to be an issue that I can't seem to resolve.
Here's what happens:...
1
vote
1
answer
1k
views
How to run an alias inside an alias in fish?
I aliased sudo to please with a space:
$ alias please='sudo '
$ please ll
I have tried this in Fish, but it doesn't work:
$ alias please='sudo '
$ please ll
sudo: ll: command not found
0
votes
3
answers
228
views
How can I edit a command? [duplicate]
I'm trying to edit the clear command. I've tried going into the bin directory then doing: "gedit clear" but it ended in failure because I can't edit the file without potentially corrupting ...
-1
votes
2
answers
491
views
Sudo aliased to please; how do i make please see aliases?
I made sudo see aliases with alias sudo='sudo '. I aliased sudo to please (alias please=sudo), and with please it didn't worked: alias please='please '. please still didn't see my aliases.
How to make ...
2
votes
2
answers
441
views
Is there any way to alias ";;" to "ll"?
I am a huge fan of aliases. this feature REALLY makes my life easier.
I have the following alias set:
alias ll="ls-lah"
However, I frequently fatfinger ll to ;;
As a solution, I attempted to ...
4
votes
2
answers
535
views
How to edit the aliases with which a program in Ubuntu is associated (and therefore will be returned in the search menu)
Pardon for for not having the correct terminology yet.
When I press the Meta button, Ubuntu lets me search for programs. When I, e.g., search for 'sound' it shows me a list of settings, programs, etc.
...
0
votes
2
answers
928
views
Is it possible to allow NOPASSWD on an alias of a command requiring sudo?
I added this alias:
alias shutdown2h='sudo shutdown -h +120'
which I would like to run without having to enter the password but also without adding NOPASSWD for the whole shutdown command.
Is it ...
0
votes
1
answer
54
views
Is there a way call an alias without separating it from previous characters?
Super new to all of this. Trying to do the overthewire wargames to learn and thought it was a bit tedious to log in to each level, and wanted to make some shortcuts. I made an alias that can take the ...
2
votes
1
answer
2k
views
my .bashrc has a typo and I do not know how to fix it
I was trying to create an alias for a command, I added the alias to the bottom of .bashrc file but when I try to run source .bashrc I get:
.bashrc (line 6): 'case' builtin not inside of switch block
...
0
votes
1
answer
223
views
Failing to connect apache2 with ScriptAlias
I'm trying to set up a ScriptAlias on an apache2 server, but when I try to connect to it using the alias, I get a Forbidden error:
This is my /etc/apache2/apache.conf:
cgi.load is enabled on /etc/...
15
votes
2
answers
3k
views
Why doesn't the "watch" command work on an alias?
So I've made my customized alias command and tried to use it with alias, but my alias was not recognized while concatenated with the watch command.
So I tried to make a thread of it and fortunately, ...
0
votes
2
answers
822
views
I can't find my alias file
Some time ago I created an alias which is still working
(base) Mac-mini ~ % type Iridis
Iridis is an alias for ssh ...
I want to modify this alias but when I go to nano ~/.bashrc the file is empty. ...
2
votes
1
answer
1k
views
how to define a variable in .bashrc so i can use it as path
Hi ( sorry for my bad English )
I just learned how to permanently set a key for a specific value using alias:
.bashrc
alias please='sudo'
alias go='cd'
alias destroy='rm -rf'
And it works perfectly ...
0
votes
1
answer
99
views
Bash Function/Alias name collision causes seg fault
The problem in this post also happened to me.
mkdir crashes bash
I couldn't comment there because no reputation.
Can anyone elucidate why this happens? It happens at runtime Not when the function is ...
1
vote
1
answer
286
views
Issues setting up bash autocomplete for Python3 alias
I've got an alias for python3, 'py' - it's set up as you might expect in my .bashrc file.
alias py='python3'
complete -F _python py
The issue is that complete will only work if I try to complete with ...
7
votes
1
answer
2k
views
How can I make a shell alias work immediately?
Defining and using an alias in the same line does not seem to work:
$ alias x=ls; x
x: command not found
How can I "escape" x in the second call so that it is recognized as an alias?
1
vote
1
answer
97
views
defining an alias is not recognized in other terminals [duplicate]
I was playing around with the command "alias" and I noticed that when I define an alias for copy to be c ( alias c="copy" ) it only work on that terminal, if I switch to another ...
0
votes
1
answer
2k
views
Why is my alias from .bashrc not working?
I've written a line in .bashrc
alias untar='sudo tar –xvzf'
Now, when I use "untar" in bash I get the error:
untar filename.tar.gz
tar: invalid option -- '�'
Try 'tar --help' or 'tar --...
7
votes
3
answers
3k
views
How to make alias to systemctl with autocomplete
I tried
alias sct='systemctl'
complete -F _systemctl sct
But the function _systemctl is not found until I run the original command systemctl in the session. This function loads dynamically or somehow ...
6
votes
4
answers
5k
views
is it possible to alias a port number?
I want to run a service on a custom port (e.g. jenkins on 8080) and I prefer to access it via browser with a name I can remember, e.g. http://localhost:jenkins which will be an alias for http://...
2
votes
4
answers
4k
views
How I can run application from anywhere in the terminal without being in the full path
I have an application that I can run while I am in the file location as the below:
-$ cd home/myApps/app
-$ ./run.sh
I want to call the run.sh from anywhere in my terminal without being in the full ...
0
votes
0
answers
27
views
I just installed Quixel and Nuke, how can I create an alias for them in Ubuntu? [duplicate]
I just installed Quixel Bridge and Nuke. They are not found in the application list so I have no way to drag them to desktop favorite. Nor did they like Google Chrome that could be started in terminal ...
1
vote
1
answer
86
views
Handy command for editing previously executed mistyped command and overwriting history entry with the fixed one
until recently I was pretty sure that fc command opens previously executed command in the default editor, executes submitted changes and overwrites last entry from the bash history. However, seems ...
1
vote
2
answers
676
views
alias settings nor working at logon
Newly installed hirsute = 21.04. Installed out of the package, created my own personal account, the default .bashrc is present in my homedir and to make sure there is a .bash_aliases too. Both mention
...