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
-2
votes
0answers
27 views

Alias is not working properly [duplicate]

We can use alias like this. alias shortName="your custom command here" means alias file="/Downloads/file.txt" Now when I will command in the terminal file, this will open the file file.txt. But in ...
-1
votes
1answer
34 views

echo alias prints space between env variable and first argument

have a weird problem..... Im configuring my arch setup and one of my aliases isnt working..... alias es='echo $SCRIPTDEST/$1' For some reason it prints a space between $SCRIPTDEST/ and $1, ruining ...
0
votes
0answers
29 views

How can I pass IP address in this script so that I can use alias to pass it to connect without using password

I am trying to use the below command in a shell script and execute that with an alias command in unix. But it does not work. How can I get this working? text.pwd contains my password and user remains ...
-2
votes
2answers
60 views

What am I doing wrong with my own alias in ~/.bash_aliases? [duplicate]

~/.bashrc My ~/.bashrc contains the following (by default): if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi ~/.bash_aliases My ~/.bash_aliases contains the following (my definition): ...
0
votes
3answers
62 views

how can I pass an alias as an argument to a shell command

I have an alias that is set up like this. alias X='`xclip -o --selection primary`' now this works great if I just want to echo my clipboard value. But I would really like to be able to use it as an ...
0
votes
1answer
33 views

Having sudo and non-sudo parts in an alias - why does it not work with >>?

I was trying to use an alias which should run two commands, where the first is fine to be run with normal user privileges and the second one needs sudo privileges. alias hosts-get="scp user@host.com:...
0
votes
0answers
43 views

Can I avoid using eval in alias re-definition?

My system: Linux Mint 19.3. My default shell: Bash. Problem: I do not like using eval (man page) if unnecessary. Question: Is there another way of redefining stored alias, which I currently do as ...
0
votes
1answer
40 views

dot (.) causing alias to break

I am trying to create an alias for the command - rsync -avh --omit-dir-times --delete --filter='protect .sync' /media/blueray/Data/_Work/ /media/blueray/Data/_CloudYandex/ The command I am using to ...
0
votes
2answers
43 views

alias help='compgen -c | sort -b' doesn't work in .bashrc but only in terminal [closed]

.bashrc: alias cls="echo -en '\033c\033[3J'" alias help='compgen -c | sort -b' terminal: cls works fine. help gives me the error: "ort: opzione non valida -- " Try 'sort --help' for more ...
0
votes
4answers
66 views

Passing parameter to alias which is part of a string

Sorry if this is a silly question. I have 4 directories in my workspace dir1, dir2, dir3 and dirzz. I need to setup an alias with one parameter to decide which directory to be called. For example $ ...
0
votes
0answers
24 views

sudo: apt-updater: command not found [duplicate]

I created a /root/.bash_aliases with a function in it like this function apt-updater { apt-get update && apt-get upgrade -y && apt-get dist-upgrade -Vy && apt-...
0
votes
1answer
16 views

alias for cross compiling kernel module

I wrote an alias for cross-compiling. alias cross_compile="make CROSS_COMPILE=x86_64-buildroot-linux-uclibc- -C /home/jamal//buildroot-2019.05/output/build/linux-4.19.16 M='$PWD' modules" But the ...
1
vote
1answer
27 views

pass multiple search terms to text browser via bash_aliases in prompt

I want to achieve a bash alias so that I can type just: $> lynxsearch most popular unix text browsers $> w3msearch most popular unix text browsers (or the search terms within quotes or ...
2
votes
2answers
39 views

Auto add argument

I had a problem with electron6 and I found out that I had to launch it with the "--disable-gpu" argument, the problem is that I use many electron app. I wanted to know if it was possible to ...
0
votes
0answers
13 views

Alias for a compound bash command with subcommands [duplicate]

I want to create an alias for a command to stop and remove all containers: docker stop $(docker ps -aq) && docker rm $(docker ps -aq) When I just paste this command in my command line, it ...
2
votes
3answers
76 views

How can I dynamically change a path in my aliases?

I have a bunch of aliases in my .cshrc file which use the path: /projects/project_name/my_name/$CLIENT I've written a short script which is intended to take a folder name from my working directory ...
0
votes
3answers
44 views

How do I pass piped input to second command in an alias?

I've defined an alias like: alias xyz='command1; command2' I want to pipe output of another command pqr to command2 like: pqr | xyz -f - Is it possible? How can I achieve that?
2
votes
1answer
56 views

Can I extend a command adding my own aliases?

I created a few aliases to work with nodejs projects such as: alias lsc="cat package.json | jq '.scripts'" to list all the available commands in the scripts portion of the package.json file Ideally ...
0
votes
1answer
34 views

How to supress aliases errors in zsh?

I want to have single list of aliases that I source to my .zshrc on all my computers and sync. But on one computer I have docker installed, and on another I don't. And every time I open terminal get ...
0
votes
1answer
183 views

How to run aliases commands in inside the vim editor? [closed]

In .bashrc file set alias alias l='ls -l' Inside Vim: :! l [No write since last change] /bin/bash: l: command not found shell returned 127
1
vote
2answers
44 views

Keyboard shortcuts in CLI as aliases or scripts

Is it possible to take a keybind/keyboard shortcut and turn it into a CLI command or integrate that keybind/keyboard shortcut into a script that can then be executed in BASH? I know this would be ...
0
votes
3answers
40 views

using aliases in function?

I have a script yummy.sh #!/bin/bash alias yumy='yum install -y ' yumprovision() { yumy } When I run this script got this bash: yumy: command not found why it's not loading alias in function?...
0
votes
1answer
49 views

Can't I define aliases (using `export`) that are in my current directory? Doing so gives a `not found` message

TLDR: have to define an alias/variable using the export command, I can't use the full path and using a relative path (i.e. defining the alias while in the directory directly above what I want to ...
0
votes
1answer
48 views

bash problem command not found everytime i open terminal

I was entering command to solve permissions denied. So i used nano made some edit in a file that I don't remember due to which everytime I open bash it displays ^X: command not found. Please help how ...
-1
votes
2answers
61 views

alias the find function and use it with sudo [duplicate]

I'm having trouble creating an alias so I can run find in "silent mode" (without all the Permission denied messages). my bash skills are pretty bad so I'm not sure how to fix this here's my alias in ~...
1
vote
2answers
94 views

alias: backup & and edit file

I need to backup files (usually images) before editing (and overwrite) them. Currently I do it by: cp file.jpg ~/BACKUP/file.jpg exiv2 BLABLABLA file.jpg How can I do it with a single command? e.g. ...
2
votes
1answer
134 views

How to pipe into zsh with alias expansion?

I'm trying to run a line from history by piping it into zsh with: cat ~/.zsh_history | cut -d ';' -f 2 | sk --tac | zsh This works if the line I pick interactively with sk is a command that is ...
0
votes
1answer
36 views

How to put temporary aliases in a file?

I can put aliases in my .bashrc (or files called from it) and they then work in my shell. I can also then create other aliases at the command line, e.g. alias aaa='ls' and it works. aaa does an ...
0
votes
2answers
60 views

Defining Custom Location aliases

I'm trying to find a way to access a directory without specifying the whole path each time. For example, i download a lot of videos and I've set up a folder to store all those videos, since I'll be ...
-1
votes
1answer
70 views

allow user access to syslog

I'm running an embedded Linux (Dreadnaught), and I'd like to be able to manually enter a line into the syslog as the user login, and have the result of other commands stored in the syslog. e.g.: ...
2
votes
2answers
105 views

building an alias from a function

I need a lot of different aliases to create ssh tunnels to different servers. To give you a few of them: alias tunnel_1='autossh -M 20000 -N -L 8080:localhost:8080 -N -L 9200:localhost:9200 -N -L ...
2
votes
1answer
76 views

How can I alias 'emacs file.txt' to 'emacs file.txt &'?

In case this is an XY problem, what I'd like to do is always open Emacs visually as a background process, but still get tab completion and not have to append '&' manually. I'm in Tcsh, no way to ...
0
votes
0answers
47 views

Why is this alias not working? [duplicate]

So I've setup this alias: alias stat='myvar=3; myothervar=3; stat' basically, when running stat, I also want to set two vars and this works echo $myvar stat <stat output shown> echo $myvar ...
0
votes
1answer
304 views

'expr: syntax error: unexpected argument' - result from alias [duplicate]

I recently added an alias to my .bash_aliases file: alias runhole="perfect && cd data_series_test && doa=$(ls -1 | wc -l) && a=$(expr $doa / 2 ) && perfect && ...
1
vote
3answers
207 views

How to create bash alias on Ubunth WSL when username has space and apostrophe

I'm trying to create the following alias in Ubuntu WSL: alias windocs='cd /mnt/c/Users/Firstname L'astname/Documents/' My username is unfortunately Firstname L'astname, including the space and ...
0
votes
1answer
37 views

$@ in alias inside script: is there a “local” $@?

I have aliased pushd in my bash shell as follows so that it suppresses output: alias pushd='pushd "$@" > /dev/null' This works fine most of the time, but I'm running into trouble now using it ...
0
votes
1answer
39 views

aliasing command options

Is there any way to alias the options of a command? For instance, I often use the options -mindepth and -maxdepth with find, but these are quite long at 9 characters apiece, and don't have ...
1
vote
1answer
86 views

How do I import aliases from a file?

I'm using a couple of aliases for Laravel artisan commands. I'm trying to store those aliases in a file for future use. Is there any way to import aliases from a file to Gnu/Linux terminal?. So I can ...
0
votes
2answers
131 views

Why is Bash automatically inserting `--color=auto` in `ls` command used in function

I have this setup file: function latest { count=${1:-5} ; echo "Just changed" ls -lrtd * | tail -$count ; } I call it: . setup Then I ask bash if the latest function is defined: &...
0
votes
0answers
15 views

Multi-Command Aliases With Additional Text [duplicate]

I (a) was not sure how to phrase this or (b) how to google around for this. Essentially, I want to add terminal aliases, for example for git, but other uses as well, that use the text after the alias ...
3
votes
1answer
112 views

Can I set my bashrc to echo $? after a particular command?

I'm familiar with setting simple aliases in my .bashrc, and think it might be capable of doing what I want, but not quite sure how to do it. The desire: always echo $? after a particular program ...
-3
votes
2answers
169 views

How to make an alias for a command? [closed]

I want to make an alias for busybox command BB=$(($(busybox)))
5
votes
1answer
78 views

Why doesn't alias work inside if?

My .bashrc sets up a bunch of aliases for me to use as needed, and then runs one of them automatically. Turns out this caused some problems with automated scripts ssh-ing into my machine, as opposed ...
1
vote
1answer
52 views

Ambigious Redirect when using alias to export environment variable of path with spaces?

I'm trying to simplify switching between KANBANFILE's using kanban.bash on Windows. I'm using several aliases such as the following for switching between KANBANFILEs: alias k.pos="export KANBANFILE=\...
0
votes
1answer
182 views

How to make alias for atom?

In linux mint, is it possible to run atom editor by command atom? I tried atom Command 'atom' is available in '/snap/bin/atom' The command could not be located because '/snap/bin' is not included in ...
0
votes
0answers
36 views

How bash expands aliases? [duplicate]

Why the following one-liner gives error "bash: ech: command not found" when run first time? alias ech="echo foo "; alias text="bar baz"; ech text However, if each command is run in a separate line, ...
1
vote
1answer
22 views

Postfix on Fedora not following Aliases

I have created a script to install Postfix and it works perfect with all my Ubuntu clients, but not on my Fedora client. The Fedora client is able to send e-mail directly to user@domain.com, but when ...
1
vote
1answer
24 views

How to reference and combine alias values

Pretty darn simple I would have expected. I have a large .bashrc file I made years ago where everything is spelled out for values on my alias's. I want to reduce the size of the file and make use of ...
1
vote
1answer
92 views

What's a convenient way to delete all aliases?

With zsh I can do this to delete all aliases: % unalias $( alias + ) I am looking for the equivalent in bash.
0
votes
0answers
26 views

Aliases for Networking Commands

I need to run a legacy script on some newer systems, without installing packages or loading binaries. The script uses some of the older networking and SysV init commands. Is there a set of aliases ...

1 2 3 4 5 14