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
61 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
30 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
16 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 ...
86
votes
30answers
25k 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 ...
0
votes
0answers
52 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 ...
2
votes
3answers
39 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. ...
12
votes
2answers
4k 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
24 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 ...
0
votes
2answers
37 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
17 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
32 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
47 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 ...
34
votes
5answers
33k 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?
1
vote
2answers
29 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
44 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?
242
votes
14answers
31k 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 ...
89
votes
5answers
66k 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
14 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
33 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 ...
91
votes
6answers
8k 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
439 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
32 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 ...
34
votes
5answers
10k 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 ...
1
vote
1answer
30 views

How to disable an alias in bash for a single command? [duplicate]

Let's say you leave your terminal open and a co-worker comes along and types: alias exit='echo nope' alias unalias='echo nope' alias type='echo nope' alias builtin='echo nope' alias ...
3
votes
1answer
30 views

Does tcsh have an equivalent for “${a:-b}” for default variable assignment like Bash?

I want to do this in one line because I want to use it in my aliases. Can I do this similarly in tcsh ? Using “${a:-b}” for variable assignment in scripts There are some ways of doing it here but ...
-1
votes
1answer
35 views

What characters are allowed in an alias?

I am confused as which are the allowed characters to be used in alias? With a function defined as f(){ echo "yes"; } Is it possible to create an alias like: alias fé='f' ### works alias ...
1
vote
0answers
188 views

Why is Apache not respecting aliased directories?

In ssl_default.conf where Apache serves as an SSL-adding proxy for Django Gunicorn, I have: ... Alias /admin/static/ "/usr/lib/python2.7/dist-packages/django/contrib/admin/static/" ...
-1
votes
1answer
12 views

Creating an alias in linux to remove mutiple files

So I'm new to Linux and I'm looking for a push in the right direction with this. I have to create a couple of new aliases in a new text file, (which I did, using pico) expect for one that has been ...
4
votes
2answers
139 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 ...
0
votes
1answer
19 views

Is it okay to add something non-TLD non-hostname as a host alias?

I added some custom (non-TLD) aliases to my /etc/hosts to get rid of IP addresses in my services configuration files. Are there any caveats/gotchas/security implications i should be aware of?
0
votes
2answers
44 views

A tricky recursive bash alias? install at first use

I wonder if this is possible, make an alias, that does a sudo apt-get to the command if it is not there already, and then realiases itself to stop making this changes. Thus I am looking for this ...
0
votes
1answer
29 views

ssh alias with localhost forwarding

Does anyone know what the best way is to create an ssh alias with a localhost argument? Everything I've searched for only includes host, hostname, etc. Such as: Host example2 Hostname example.com ...
3
votes
1answer
92 views

Why Can't I Call Two Aliases With “;”?

When I try to combine two normal commands using the ; character (eg. ls; cd) it works fine. However, I have two aliases that I've created (stopdev and startdev), and if I try to combine them: ...
1
vote
2answers
45 views

parameter aliases

For example is it possible if I could something like below. alias sd='sudo su - <parameter>' if I write like below in command prompt. $sd parameter It would sudo me to given ID as ...
1
vote
1answer
2k views

SUSE Linux 12 - configuring IP alias

I want to setup an IP address alias on a network card. I created a file /etc/sysconfig/network/ifcfg-ens160 and its contents are: BOOTPROTO='static' STARTMODE='onboot' IPADDR='192.168.0.113' ...
1
vote
3answers
62 views

What are some of the most useful aliases and bash scripts? [closed]

I just picked up some basic bash over at Codecademy today. I was curious what some commonly-used or personal favorite aliases and bash scripts are out there to put in my bash_profile document. Is ...
25
votes
3answers
5k views

aliasing cd to pushd - is it a good idea?

Is it a good idea to use the following alias: cd() { pushd $1; } in bash? I think this would be very useful, since I can then use a series of popds instead of just a cd - once. Is there any ...
0
votes
1answer
19 views

why does /var/mail/{username} = /Users/{username}?

My basic question is why do both of these paths point to home (i.e., ~)? Is it pointing to the same home or is it duplicated? I doubt it's duplicated, so if not, how does cd .. decide which directory ...
0
votes
1answer
42 views

Syntax of bash alias definition

I'm using Cygwin, and have installed all the developer packages as well as most if not all of the other packages. When I provide an alias for gcc, I get the error -bash: alias: gcc: not found What ...
2
votes
3answers
152 views

How to alias rm to always confirm

When I use the command rm -rf, I want to make sure a prompt always appears before deleting a file, so I tried adding this to ~/.bashrc alias 'rm -rf'='rm -rfi' But it doesn't work. How can I fix ...
3
votes
1answer
99 views

How to create an alias for two Git commands that use a parameter? [duplicate]

I regularly have to delete a local and remote Git branch. Therefore, I run the following commands: $ git branch -d feature-branch $ git push --delete origin feature-branch Since I mostly execute ...
0
votes
2answers
89 views

How do I permanently remove an Alias from my Shell

When I was not near my computer some guy got it and set an Alias for ls in my root folder. He set it to 'yes NeverGonnaGiveYouUp'. So now when im in my root folder and type ls I get an infinite loop ...
1
vote
1answer
136 views

sudo: nocorrect: command not found

I am using zsh and oh-my-zsh on Arch Linux. I am not able to make directory using mkdir edward@ArchLinux ~ $ sudo mkdir -p /samba/raspberry [sudo] password for edward: sudo: nocorrect: command ...
0
votes
4answers
37 views

Alias for listing top file and directory consumption - shortest way?

function isaix { echo "alias d='du -sm -- * 2>/dev/null | sort -nr | head -20'" >> ~/.kshrc; } function islinux { echo "alias d='du -sm -- * 2>/dev/null | sort -nr | head -20'" >> ...
1
vote
2answers
27 views

bash adding a filename to an alias command [duplicate]

I have an alias to a ffmpeg command to start recording a session like this: alias sreq='ffmpeg -f x11grab -r 24 -s 1024x768 -i :0.0 -qp 0 -c:v libx264 -preset veryslow' I can just type sreq ...
3
votes
4answers
704 views

How can I turn the behavior of `gedit something & disown` into the default behavior when calling gedit from the command line?

When I gedit files from the command line, it's always locking the terminal, and I'm tired of explicitly commanding a detached process for it. I tried to alias gedit as something like gedit $* & ...
0
votes
3answers
26 views

Implementing a command that executes the given command in a certain path and returns to the current path

my code: execInPath() { prev_dir=${PWD##*/} cd $1 shift res=$($@) cd prev_dir echo res } alias path=execInPath $ path ~ ls gives: bash: cd: prev_dir: No such file or directory (and the files in my ...
4
votes
1answer
370 views

How to trigger a 2nd command when a specific command is run in the shell?

I'll explain my question with example. I run $ python manage.py to perform some action. I want to run another command $ xyz , just when any user runs the previous command. Thus, from now on, ...
3
votes
2answers
154 views

Can I concatenate a bash alias?

Sample : to use Composer locally, I must write : php composer.phar After some locals installation of Composer, I want to alias it only "composer" but keeping absolute path with "pwd" command. I ...
1
vote
2answers
80 views

How to define alias for non interactive/non login shell?

I have a user (zabbix) with shell set to /sbin/nologin. The user's home is /var/lib/zabbix and I inserted alias curl='curl -k' into ~zabbix/.bashrc. However it does not work when I (for testing ...