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.

learn more… | top users | synonyms

1
vote
2answers
36 views

deferring argument in “alias” in .bashrc

I am a dumb user, who works with LINUX (ubuntu 14) My newly purchased laptop forces me to use the bash shell, and it has .bashrc. I used to use the C-shell before that and tried to copy its aliases ...
0
votes
2answers
18 views

How to define an alias without executing dollar signs contained inside?

I have the alias : alias gwanip=echo "$(dig +short myip.opendns.com @resolver1.opendns.com). This works fine except I just realized that it executes the command dig everytime bashrc is sourced. How do ...
3
votes
2answers
138 views

executing alias on variable in bash

I am a bash newbie and I came upon this strange behaviour in my bash script. #!/bin/bash V=a alias $V="echo test" echo $(a) #returns 'test' echo $($V) #returns ...'a: ...
2
votes
1answer
41 views

Is aliasing over a coreutil command a bad idea? [closed]

I frequently find myself copying large directories and then thinking "darn, I should've used rsync instead of cp for this because I can get progress updates". I'm considering adding this to my ....
0
votes
0answers
25 views

alias defined in modulefile does not work in launched shell [duplicate]

I am trying to get aliases working on my company's number crunching machine, which uses the bash shell on CentOS 7. For software management, we use GNU modules. Some case set-ups for certain ...
5
votes
1answer
592 views

How to enable `sudo` with custom functions?

Recently I learned you can enable sudo for custom aliases as follows: alias sudo='sudo ' # note: the space is required! The reason this works is the following: If the last character of the ...
0
votes
2answers
44 views

aliasing command which takes argument with using pipe

I would like to create an alias in my ~/.bash_profile that will: Take two arguments $1 $2 Pass these to diff Pipe the output to less I have not found any solutions on Stack that do what I need, ...
51
votes
6answers
11k views

How to use `which` on an aliased command?

Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance, alias vim='vim -X' alias grep='grep -E' alias ls='ls -G' The problem is ...
35
votes
5answers
36k views

How can I install the `ll` command on Mac OS X?

I'm using Mac OS X. When I SSH into servers I find the ll command useful, but it's not available on my local machine. How can I install it?
35
votes
5answers
11k views

How can I `alias sudo !!`?

I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal !! and prints sudo: !!: command not found If I use double quotes, it substitutes ...
0
votes
1answer
29 views

zsh alias with arguements

I have an alias for neovim-qt thus defined: gvim='nvim-qt --geometry 500x320 --' This allows me to call gvim foo.py ook.py and have a QT window running neovim with two tabs, one for each file. ...
0
votes
1answer
17 views

creating shortcuts in Mac OSX at command line

I run a MacBook Pro with yosemite OSX. I'm trying to create shortcuts to go to certain directories, run script files, etc. This is my first attempt at creating shortcuts/aliases. I'm asking in this ...
20
votes
4answers
4k views

Is there a 'rc' configuration file for grep/egrep? (~/.egreprc?)

I usually do some grep when developing, and there are some extensions that I always don't want to look for (like *.pyc). Is it possible to create a ~/.egreprc or something like that, and put some ...
3
votes
2answers
788 views

Bash - “/” is a directory

This is really confusing... I currently have a Debian 8 computer, and I connect to it using PuTTY (SSH). The default console used is Bash. When I try to pass a path to an alias, it gives the ...
8
votes
0answers
126 views

How to make the zsh “correct” functionality, remember my spell-correction decisions

I have enabled correction (I wouldn't call it autocorrection specifically because of this issue) in zsh by enabling setopt correct in my .zshrc. Now, when I type dtae in a terminal, I get: dtae ...
3
votes
4answers
2k views

Non-interactive shell expand alias

I'm having trouble getting aliases to expand on my hosting account when I run a command like: ssh user@server "bash -c \"alias\"" My .bashrc file is: echo .bashrc # .bashrc shopt -s ...
0
votes
0answers
18 views

How to give an arbitrary name for a register in vim

Is there any possible way to give an arbitrary name for a register in vim. I am able to use "[a-z]p while pasting. But, I would like to know, if there is anyway by which we can use arbitrary names for ...
0
votes
1answer
25 views

how to load a bash alias for graphical terminal emulator

What I'm trying to do: Load an alias The alias: alias notes='cd ~/project/notes' My system: Ubuntu 16.04 and gnome terminal 3.18.3 In my home directory there are the following bash related files: ...
12
votes
1answer
263 views

Setting temporary bash aliases when entering a folder

Sometimes I like to have very customized bash aliases and maybe keybindings when I enter on a folder (can be a project where I'm used to type lots of commands from CLI). Lets suppose when I enter a ...
1
vote
2answers
50 views

Alias in bashrc - can't get it to work [closed]

I created a shell script and wish to add it to bashrc. I opened /home/jub/bashrc and added the following to the end of the file: alias myfilesync = './/home/jub/Documents/scripts/myfilesync.sh' Then ...
4
votes
1answer
100 views

How can I test if a particular alias is defined?

I have a bash script that needs to behave differently if a particular alias is defined. Is there a way to test if a particular command is an alias in bash?
0
votes
1answer
43 views

How to save an alias of an eval $(other_comand) command

I've been using docker for a while and there's a command I write each time I boot up my docker: eval $(docker-machine env) I know eval shouldn't be used unless necessary, but it's mentioned by the ...
1
vote
1answer
34 views

bash - aliased command - use original command? [duplicate]

I have ls aliased to ls and some flags, however, I want to use the original, 'vanilla' version of ls in another alias. Is there a way for me to call the original version of ls?
91
votes
31answers
27k views

Quick directory navigation in the terminal

I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/. But I don't want to type cd /[full-path]/...
154
votes
18answers
88k views

How to have tail -f show colored output

I'd like to be able to tail the output of a server log file that has messages like: INFO SEVERE etc, and if it's SEVERE, show the line in red; if it's INFO, in green. What kind of alias can I ...
1
vote
1answer
27 views

Alias that runs a command using sudo

Im always running a particular app as root because it requires more privileges. I usually just sudo it. I want to make an alias that is something similar to: alias myCmd='sudo nohup /path/to/binary &...
3
votes
1answer
84 views

Run one command after another in zsh when Ctrl-C is pressed

I have recently moved to zsh from bash (on OSX). I have an bash alias I have used to run one program then another (even if previous program exits with error) on bash. I can't work out how to ...
2
votes
1answer
45 views

Can I use an environment variable to define an alias?

I'm using an automation engine to run perl scripts. script_X requires a wrapper script so it's run like: wrapper_script script_X --parameters But the automation engine can't understand that ...
0
votes
1answer
38 views

set alias for a directory

I am trying to set an alias that would allow me to quickly cd to the following directories: /home/user/asreera/Aravind/sample/src /home/user/asreera/Aravind/sample2/src First I set the variable: ...
4
votes
4answers
191 views

show only physical disks when using df and mount

When I use df or mount, I'm most of all interested in physical disk partitions. Nowadays the output of those commands is overwhelmed by temporary and virtual filesystems, cgroups and other things I am ...
1
vote
2answers
82 views

forward aliases to child process

I have some aliases which are defined in /etc/zprofile (or /etc/profile for bash). Also $PATH gets manipulated there. I want to start an interactive shell from a shell which avoids the $PATH ...
2
votes
1answer
32 views

Improve existing alias to dynamically replace command line text

I have an alias in .bashrc like this: alias ylog = "yarn logs -applicationId" This works well when I do ylog application_123. Sometimes, my job names come in the form of job_123 instead of ...
1
vote
1answer
21 views

How to execute alias right after sourcing it in a one liner?

I'm trying to write a one liner that sources aliases, then calls one of those newly sourced aliases. My one liner is basically: alias startEnv sourceAliasFile;runNewAlias Since I'm using csh, I can'...
0
votes
0answers
61 views

Why alias could not be found in the shell

I was trying to set the alias for command: {cutadapt -O 24 -q 19,19 -m 30 -g TATAGAATTCGCGGCCGCTCGCGATAATACGACTCACTATAGGGCGTTTTTTTTTTTTTTTTTTTTTTTT -g ...
3
votes
3answers
57 views

Create a nickname to substitute a string without $VARIABLE, in bash cli

Is it possible to create nicknames for frequently used strings, without using the '$' in front of $variables? The string can be fixed and does not need to change for the lifetime of the shell prompt. ...
14
votes
2answers
5k views

watch command alias expansion

If a run the watch command containing an alias, it will not expand the alias. I have tried both with single quote and double quotes, in fact given the following alias: # alias ll alias ll='ls -l --...
2
votes
1answer
25 views

Why is a daily .zshrc reload required using an alias containing $(date -u +%Y%m%d)? [closed]

Each morning I run the following command that tails a log file created daily: ssh -t server@55.555.55.55 tail -f development/abc/$(date -u +%Y%m%d).log This works just fine and each morning the log ...
1
vote
2answers
93 views

Fish-Shell Will Not Save my Aliases

I do not know why, but after making a whole bunch of fish aliases. I'm assuming I have neglected one simple step after assigning them all but I cannot seem find the solution myself. Can anyone lend ...
0
votes
2answers
19 views

ZSH function to edit a file based on an input at the cli

I need to set up a function in zsh that would edit a different file based on some input at the command line. I want to simplify my aliases so I don't have multiple aliases to do the same thing but ...
-1
votes
2answers
35 views

errors using alias for an awk command

I'm attempting to add this alias to my .zshrc but run into errors. I've tried escaping the ==, ", and && values and still no luck. What am I missing? alias broke="ssh -t server@5.555.555.555 ...
3
votes
1answer
78 views

When using an SSH alias, why is SSH ignoring my (valid) Kerberos ticket?

I am successfully connecting to my university's network via ssh with Kerberos ticket authentication. Normal, verbose operation (kinit a ticket, then ssh user@hostname) works fine. The Problem When ...
1
vote
2answers
32 views

how to set alias of command in bash that contains both single and double qoutes [duplicate]

I am not able to set alias of hexdump -e '/1 "%_ax) "' -e '/1 "%02X" "\n"' I have tried following methods but failed: alias analyze=\'hexdump -e '/1 "%_ax) "' -e '/1 "%02X" "\n"'\' (note the ...
1
vote
2answers
69 views

How to override option in aliased command? [duplicate]

I have a rm aliased: alias rm='rm -i' How can I override the -i option when I want to remove a large number of files and I don't want to confirm each deletion?
246
votes
14answers
33k views

In Bash, when to alias, when to script, and when to write a function?

It's taken me almost 10 years of Linux usage to ask this question. It was all trial and error and random late-night internet surfing. But people shouldn't need 10 years for this. If I were just ...
102
votes
5answers
72k views

Why doesn't my Bash script recognize aliases?

In my ~/.bashrc file reside two definitions: commandA, which is an alias to a longer path commandB, which is an alias to a Bash script I want to process the same file with these two commands, so I ...
1
vote
1answer
15 views

Should I set PAGER environment variable, alias or symbolic link?

I noticed that when using aliases, some programs launch pager directly (either from PATH or through PAGER). I'd like to define default pager for all cases, not just when I type the command. Should I ...
2
votes
1answer
51 views

alias ? not working in zsh

I was lead to believe that there were no differences between aliases in zsh and bash, however that appears to not be the case. I had an alias that would help me familiarize myself with the command ...
92
votes
6answers
9k views

Run a command that is shadowed by an alias

Let's say i have the following alias in bash - alias ls='ls --color=auto' - and i want to call ordinary ls without options. Is the only way to do that is to unalias, do the command and then alias ...
1
vote
1answer
595 views

GNOME 3.14+ launch new gnome-terminal and set title

To the disappointment of many, tab/window title can't be set anymore with --title I use bash. I have had a few aliases I have used to connect to remote servers with. alias c:prod='gnome-terminal --...
-1
votes
1answer
49 views

All Aliases Stopped working suddenly (Linux Ubuntu 14.04.4 LTS) [closed]

I have been using my system with Ubuntu for almost a year now. I have been using a .bashrc file throughout this time. I have build it according to my needs. Suddenly it stopped working and none of ...