Skip to main content

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.

1 vote
1 answer
143 views

use aliases in bash script

I use aliases in my code, it works the first time and shows the current time, but the second time, when I call it shows past time(time showed before instead of current time) GNU nano 6.2 ...
Milad Alkhamis's user avatar
0 votes
0 answers
42 views

Last login command, alias in csh

In the C shell, how can we display the login history of a particular user using an alias in such a way that the user only enters the alias name and the number of lines to be displayed without typing ...
learner's user avatar
1 vote
1 answer
266 views

How to write a function that takes an argument string that does not need to be quoted?

I'm writing a function, adding it to ~/.zshrc on my Mac. It's in order to more quickly handle commands to youtube-dl. I have this: function dlv() { cd /Users/admin/Downloads youtube-dl ...
Alfie Stoppani's user avatar
1 vote
0 answers
81 views

How should alias in command substitution behave?

I tested a few scripts with different shells, and the results differ. # test 1 foo(){ echo $(al);} alias al='echo 123' foo # test 2 alias al='echo 123' foo(){ echo $(al);} alias al='echo abc' foo # ...
anonymous's user avatar
1 vote
0 answers
115 views

can we trigger some action if we `cd` into directory? [duplicate]

I have multiple projects over various languages like JavaScript, Python. I wonder if Linux provides some functionality to trigger some actions automatically if we cd into a particular directory? For ...
Visrut's user avatar
  • 137
0 votes
1 answer
163 views

Bash alias is not executing as expected

Having read a little of alises, I wanted to try one but I couldn't get it to work. Why does this alias not work? $ printenv PWD /home/vm $ alias testpwd="$PWD" $ testpwd -bash: /home/vm: Is ...
john smith's user avatar
1 vote
2 answers
1k views

/etc/zshrc is not applied when log in

I have no idea why having aliases that are applied to all interactive terminal (i.e., my user account and sudo) is so difficult. Most web search result were about BASH, but my shell is ZSH (Manjaro ...
Damn Vegetables's user avatar
0 votes
5 answers
260 views

Whitespaces in alias bashrc

I use Bash I wrote a command for printing only docker id separate with whitespaces on one line. docker ps -a | grep -E '^[a-z0-9]{12}' -o | awk '{printf "%s ",$0} END {print ""}' ...
Admineral's user avatar
0 votes
1 answer
45 views

Primitive Alias doesn't work in Bash [duplicate]

I wrote the following rather primitive alias: alias unshorten="curl -k -v -I $1 2>&1 | grep -i '< location' | cut -d ' ' -f 3" It's meant to unshorten the shortened link and then ...
Sir Muffington's user avatar
1 vote
2 answers
351 views

Rename terminal title && run application using alias

Trying to create a command that rename terminal title and run a application, I'm adding the commands inside .bash_aliases file. The rename command I'm using is: PS1='\[\e]0;test\a\]${debian_chroot:+($...
raijin's user avatar
  • 13
0 votes
3 answers
256 views

How to avoid nesting root shells? (POSIX)

Consider the following Bash alias, just something that came to mind quickly, and I did not have time to dig further: alias su='sudo -s' Note, that I am running Bash, though I would like the solution ...
Vlastimil Burián's user avatar
1 vote
2 answers
554 views

Do bash aliases only work at beginning of line?

First, I ran touch file.txt Next, I ran these commands: alias xx="file.txt" vim xx Expected behavior: vim loads file.txt. Actual behavior: vim loads a new file xx. Why? Is it because ...
WalksB's user avatar
  • 145
1 vote
0 answers
958 views

Multiple hostnames for a single IP address in local network

I'd like to know if it is possible to have multiple hostnames for a single IP address in my local network, so that all hostnames point to the same IP-address (kind of an alias) Example: name ...
Rudolf Ziegaus's user avatar
0 votes
2 answers
150 views

bash alias to randomly run a command among many

I need help figuring out how to run a bash alias or function that randomly chooses another command or alias and runs it. the list of commands and aliases and function aliases is known beforehand. the ...
stacking and exchanging woohoo's user avatar
0 votes
0 answers
11 views

How can I make uncommon symbols more accessible?

I am using Bash in Linux, inside Termius on a smartphone. I would like to make reaching for particular symbols as fast as possible, by customizing bash to interpret certain character sequences as ...
Julius Hamilton's user avatar

15 30 50 per page
1 2 3
4
5
61